Class: HashReader
- Inherits:
-
Object
- Object
- HashReader
- Defined in:
- lib/worlddb/readers/hash_reader.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logger = nil, path) ⇒ HashReader
constructor
A new instance of HashReader.
Constructor Details
#initialize(logger = nil, path) ⇒ HashReader
Returns a new instance of HashReader.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/worlddb/readers/hash_reader.rb', line 6 def initialize( logger=nil, path ) if logger.nil? @logger = Logger.new(STDOUT) @logger.level = Logger::INFO else @logger = logger end @path = path ## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark) ## - see worlddb/utils.rb @hash = YAML.load( File.read_utf8( @path )) end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
21 22 23 |
# File 'lib/worlddb/readers/hash_reader.rb', line 21 def hash @hash end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
21 22 23 |
# File 'lib/worlddb/readers/hash_reader.rb', line 21 def logger @logger end |