diff options
Diffstat (limited to 'lib/psych/core_ext.rb')
-rw-r--r-- | lib/psych/core_ext.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/psych/core_ext.rb b/lib/psych/core_ext.rb new file mode 100644 index 0000000000..bd22219c07 --- /dev/null +++ b/lib/psych/core_ext.rb @@ -0,0 +1,22 @@ +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 + alias :to_yaml :psych_to_yaml +end + +module Kernel + def y *objects + puts Psych.dump_stream(*objects) + end +end |