Class: HashReaderV2
- Inherits:
-
Object
- Object
- HashReaderV2
- Includes:
- LogUtils::Logging
- Defined in:
- lib/textutils/reader/hash_reader.rb
Overview
todo/fix: find a better name than HashReaderV2 (HashReaderPlus?) ??
Instance Attribute Summary collapse
-
#include_path ⇒ Object
readonly
Returns the value of attribute include_path.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(name, include_path) ⇒ HashReaderV2
constructor
A new instance of HashReaderV2.
Constructor Details
#initialize(name, include_path) ⇒ HashReaderV2
Returns a new instance of HashReaderV2.
12 13 14 15 |
# File 'lib/textutils/reader/hash_reader.rb', line 12 def initialize( name, include_path ) @name = name @include_path = include_path end |
Instance Attribute Details
#include_path ⇒ Object (readonly)
Returns the value of attribute include_path.
18 19 20 |
# File 'lib/textutils/reader/hash_reader.rb', line 18 def include_path @include_path end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/textutils/reader/hash_reader.rb', line 17 def name @name end |
Instance Method Details
#each ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/textutils/reader/hash_reader.rb', line 20 def each path = "#{include_path}/#{name}.yml" reader = HashReader.new( path ) logger.info "parsing data '#{name}' (#{path})..." reader.each do |key, value| yield( key, value ) end ## fix: move Prop table to props gem - why? why not?? WorldDb::Models::Prop.create_from_fixture!( name, path ) end |