1class Object
2  def self.yaml_tag url
3    Psych.add_tag(url, self)
4  end
5
6  # FIXME: rename this to "to_yaml" when syck is removed
7
8  ###
9  # call-seq: to_yaml(options = {})
10  #
11  # Convert an object to YAML.  See Psych.dump for more information on the
12  # available +options+.
13  def psych_to_yaml options = {}
14    Psych.dump self, options
15  end
16  remove_method :to_yaml rescue nil
17  alias :to_yaml :psych_to_yaml
18end
19
20class Module
21  def psych_yaml_as url
22    return if caller[0].end_with?('rubytypes.rb')
23    if $VERBOSE
24      warn "#{caller[0]}: yaml_as is deprecated, please use yaml_tag"
25    end
26    Psych.add_tag(url, self)
27  end
28
29  remove_method :yaml_as rescue nil
30  alias :yaml_as :psych_yaml_as
31end
32
33if defined?(::IRB)
34  require 'psych/y'
35end
36