summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/psych.rb8
-rw-r--r--test/test_psych.rb6
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/psych.rb b/lib/psych.rb
index bdc2458..bbb8662 100644
--- a/lib/psych.rb
+++ b/lib/psych.rb
@@ -19,7 +19,11 @@ module Psych
VERSION = '1.0.0'
LIBYAML_VERSION = Psych.libyaml_version.join '.'
- def self.parse thing
- Psych::Parser.new.parse thing
+ ###
+ # Load +yaml+ in to a Ruby data structure
+ def self.load yaml
+ parser = Psych::Parser.new(TreeBuilder.new)
+ parser.parse yaml
+ parser.handler.root.children.first.to_ruby
end
end
diff --git a/test/test_psych.rb b/test/test_psych.rb
index 865024f..96d0f69 100644
--- a/test/test_psych.rb
+++ b/test/test_psych.rb
@@ -2,9 +2,9 @@ require 'minitest/autorun'
require 'psych'
class TestPsych < MiniTest::Unit::TestCase
- #def test_simple
- # assert_equal 'foo', Psych.parse("--- foo\n")
- #end
+ def test_simple
+ assert_equal 'foo', Psych.load("--- foo\n")
+ end
def test_libyaml_version
assert Psych.libyaml_version