summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/core_ext.rb
blob: 9c55c707a1228d24672f57b957954b0b97f5b257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Object
  def self.yaml_tag url
    Psych.add_tag(url, self)
  end

  # FIXME: rename this to "to_yaml" when syck is removed

  ###
  # call-seq: to_yaml
  #
  # Convert an object to YAML
  def psych_to_yaml options = {}
    Psych.dump self, options
  end
  remove_method :to_yaml rescue nil
  alias :to_yaml :psych_to_yaml
end

module Kernel
  def psych_y *objects
    puts Psych.dump_stream(*objects)
  end
  remove_method :y rescue nil
  alias y psych_y
end