summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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