From 6c4ab641b15252929046dcf169750e49cf148f63 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 29 Sep 2009 17:36:08 -0700 Subject: adding syck compatible methods --- lib/psych.rb | 6 +++++- lib/psych/nodes/node.rb | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3