diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-10-03 14:33:17 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-10-03 14:33:17 -0700 |
commit | cda70ad5dde3d8cfda2e9fb31bdb106a0924c4d4 (patch) | |
tree | d9631b1efefd3c80b6c74aa9985ac3214667f27d /lib | |
parent | 2422a9fc3aeff3c60c6510efbf655a34218c7605 (diff) | |
download | psych-cda70ad5dde3d8cfda2e9fb31bdb106a0924c4d4.zip |
Use `yaml` rather than `to_yaml` to avoid ENGINE changes removing this
method.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych.rb | 6 | ||||
-rw-r--r-- | lib/psych/nodes/node.rb | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/psych.rb b/lib/psych.rb index 24f90b0..aaf883f 100644 --- a/lib/psych.rb +++ b/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/lib/psych/nodes/node.rb b/lib/psych/nodes/node.rb index 2a5573a..0cefe44 100644 --- a/lib/psych/nodes/node.rb +++ b/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 |