diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2009-09-29 17:36:08 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2009-09-29 17:36:08 -0700 |
commit | 6c4ab641b15252929046dcf169750e49cf148f63 (patch) | |
tree | 84c99c8fc761e4192912f2258a9405de7265662d | |
parent | f9764c806980a663dbc75a8ec1764d02a225595d (diff) | |
download | psych-6c4ab641b15252929046dcf169750e49cf148f63.zip |
adding syck compatible methods
-rw-r--r-- | lib/psych.rb | 6 | ||||
-rw-r--r-- | lib/psych/nodes/node.rb | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/psych.rb b/lib/psych.rb index bbb8662..e8f7ade 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -22,8 +22,12 @@ module Psych ### # Load +yaml+ in to a Ruby data structure def self.load yaml + parse(yaml).to_ruby + end + + def self.parse yaml parser = Psych::Parser.new(TreeBuilder.new) parser.parse yaml - parser.handler.root.children.first.to_ruby + parser.handler.root.children.first.children.first end end diff --git a/lib/psych/nodes/node.rb b/lib/psych/nodes/node.rb index a63fc60..6aaba15 100644 --- a/lib/psych/nodes/node.rb +++ b/lib/psych/nodes/node.rb @@ -17,6 +17,7 @@ module Psych def to_ruby Visitors::ToRuby.new.accept self end + alias :transform :to_ruby def to_yaml io = StringIO.new |