Class: MasterRecord::YAML
- Inherits:
-
Object
- Object
- MasterRecord::YAML
- Includes:
- Enumerable
- Defined in:
- lib/master_record/yaml.rb
Class Method Summary collapse
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(fields, datum) ⇒ YAML
constructor
A new instance of YAML.
Constructor Details
#initialize(fields, datum) ⇒ YAML
Returns a new instance of YAML.
16 17 18 19 |
# File 'lib/master_record/yaml.rb', line 16 def initialize(fields,datum) @fields = fields @datum = datum end |
Class Method Details
.load_file(fields, file) ⇒ Object
11 12 13 14 |
# File 'lib/master_record/yaml.rb', line 11 def self.load_file(fields,file) datum = ::YAML.load_file(file) new(fields,datum) end |
Instance Method Details
#each ⇒ Object
5 6 7 8 9 |
# File 'lib/master_record/yaml.rb', line 5 def each @datum.each do|k,v| yield ([k] + @fields.map{|name,t| v[name.to_s]}).flatten end end |