Class: Simmer::Util::YamlReader
- Inherits:
-
Object
- Object
- Simmer::Util::YamlReader
- Defined in:
- lib/simmer/util/yaml_reader.rb
Overview
Understands how to read YAML. You can utilize this tool to recursively read an entire directory of YAML files and combine them into one YAML file, or simply read one YAML file.
Instance Method Summary collapse
Instance Method Details
#read(path) ⇒ Object
23 24 25 |
# File 'lib/simmer/util/yaml_reader.rb', line 23 def read(path) (path).map { |file| OpenStruct.new(path: file, data: raw(file)) } end |
#smash(path) ⇒ Object
19 20 21 |
# File 'lib/simmer/util/yaml_reader.rb', line 19 def smash(path) read(path).each_with_object({}) { |file, memo| memo.merge!(file.data || {}) } end |