diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/psych/lib/psych.rb | 6 | ||||
-rw-r--r-- | ext/psych/lib/psych/nodes/node.rb | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 24f90b0bb4..aaf883f4b2 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -190,7 +190,7 @@ module Psych visitor = Psych::Visitors::YAMLTree.new options visitor << o - visitor.tree.to_yaml io, options + visitor.tree.yaml io, options end ### @@ -204,7 +204,7 @@ module Psych objects.each do |o| visitor << o end - visitor.tree.to_yaml + visitor.tree.yaml end ### @@ -212,7 +212,7 @@ module Psych def self.to_json o visitor = Psych::Visitors::JSONTree.new visitor << o - visitor.tree.to_yaml + visitor.tree.yaml end ### diff --git a/ext/psych/lib/psych/nodes/node.rb b/ext/psych/lib/psych/nodes/node.rb index 2a5573a2bd..0cefe44e44 100644 --- a/ext/psych/lib/psych/nodes/node.rb +++ b/ext/psych/lib/psych/nodes/node.rb @@ -40,13 +40,14 @@ module Psych # Convert this node to YAML. # # See also Psych::Visitors::Emitter - def to_yaml io = nil, options = {} + def yaml io = nil, options = {} real_io = io || StringIO.new(''.encode('utf-8')) Visitors::Emitter.new(real_io, options).accept self return real_io.string unless io io end + alias :to_yaml :yaml end end end |