summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-09-29 17:36:08 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-09-29 17:36:08 -0700
commit6c4ab641b15252929046dcf169750e49cf148f63 (patch)
tree84c99c8fc761e4192912f2258a9405de7265662d
parentf9764c806980a663dbc75a8ec1764d02a225595d (diff)
downloadpsych-6c4ab641b15252929046dcf169750e49cf148f63.zip
adding syck compatible methods
-rw-r--r--lib/psych.rb6
-rw-r--r--lib/psych/nodes/node.rb1
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