summaryrefslogtreecommitdiff
path: root/lib/psych.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-10-08 15:24:56 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-10-08 15:24:56 -0700
commitbe5a4cb845025170c0a8b843faa478989e499f51 (patch)
tree19f7808d8269230df5a2108abe44de6badfc1557 /lib/psych.rb
parent57c468a5f8bd3ffc1cb93b07db6b823872316a18 (diff)
downloadpsych-be5a4cb845025170c0a8b843faa478989e499f51.zip
supporting load documents
Diffstat (limited to 'lib/psych.rb')
-rw-r--r--lib/psych.rb9
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