diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-03 21:31:43 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-10-03 21:31:43 +0000 |
commit | 1c60db55ac07b238d9d4e1443f5b6f8dd1fa9da0 (patch) | |
tree | 228a5a5273452b8a04ae4d07cb14198342cc646f /ext/psych | |
parent | bd3b0d470c12fbdb48efcdb310d00eaa0fea84e5 (diff) | |
download | ruby-1c60db55ac07b238d9d4e1443f5b6f8dd1fa9da0.tar.gz |
* ext/psych/lib/psych.rb: calling `yaml` rather than `to_yaml`.
* ext/psych/lib/psych/nodes/node.rb: Rename `to_yaml` to just `yaml`
in order to avoid YAML::ENGINE switching from replacing this method.
* test/psych/helper.rb: fix tests for method name change.
* test/psych/test_document.rb: ditto
* test/psych/visitors/test_emitter.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych')
-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 |