SixArm.com » Ruby » YAML load documents via globs for many files at once

Author

Joel Parker Henderson, [email protected]

Copyright

Copyright © 2006-2011 Joel Parker Henderson

License

See LICENSE.txt file

Load YAML files by specifying file globs, and yield to blocks for more convenient processing of the results.

@example To load documents from all files that end in “.yaml”

YAML.load_documents_globber_and_yield_document('*.yaml'){|document|
    #...whatever you want to do with each yaml document
}

@example To load documents from all files that end in “.yaml” and process the key-value pairs:

YAML.load_documents_globber_and_yield_key_values('*.yaml'){|key,values|
    #...whatever you want to do with each yaml key and its yaml values
}