diff options
Diffstat (limited to 'lib')
-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 |