diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2009-10-08 15:24:56 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2009-10-08 15:24:56 -0700 |
commit | be5a4cb845025170c0a8b843faa478989e499f51 (patch) | |
tree | 19f7808d8269230df5a2108abe44de6badfc1557 /lib/psych.rb | |
parent | 57c468a5f8bd3ffc1cb93b07db6b823872316a18 (diff) | |
download | psych-be5a4cb845025170c0a8b843faa478989e499f51.zip |
supporting load documents
Diffstat (limited to 'lib/psych.rb')
-rw-r--r-- | lib/psych.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/psych.rb b/lib/psych.rb index 2d0cf0c..f1ee542 100644 --- a/lib/psych.rb +++ b/lib/psych.rb @@ -45,4 +45,13 @@ module Psych def self.dump o o.to_yaml end + + ### + # Load multiple documents given in +yaml+, yielding each document to + # the block provided. + def self.load_documents yaml, &block + yaml_ast(yaml).children.each do |child| + block.call child.to_ruby + end + end end |