Method: Epos::IndexFile#initialize
- Defined in:
- lib/epos/index-file.rb
#initialize(path) ⇒ IndexFile
Returns a new instance of IndexFile.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/epos/index-file.rb', line 6 def initialize(path) data = EncodedFile.read(path) lines = data.lines @index = {} lines.each do |line| i = line.index(";") key = line[0..i - 1] val = line[i + 1..-2].to_i if @index.has_key?(key) @index[key] << val else @index[key] = [val] end end end |