diff options
Diffstat (limited to 'lib/psych.rb')
-rw-r--r-- | lib/psych.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/psych.rb b/lib/psych.rb index bbb8662..3ebc1fa 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -13,6 +13,7 @@ require 'psych/visitors' require 'psych/handler' require 'psych/tree_builder' require 'psych/parser' +require 'psych/ruby' require 'psych/psych' module Psych @@ -22,8 +23,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 |