From 1c60db55ac07b238d9d4e1443f5b6f8dd1fa9da0 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Mon, 3 Oct 2011 21:31:43 +0000 Subject: * 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 --- ext/psych/lib/psych.rb | 6 +++--- ext/psych/lib/psych/nodes/node.rb | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'ext/psych/lib') 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 -- cgit v1.2.3