Class: Epos::DataFile

Inherits:
Object
  • Object
show all
Defined in:
lib/epos/data-file.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ DataFile

Returns a new instance of DataFile.



7
8
9
# File 'lib/epos/data-file.rb', line 7

def initialize(path)
  @file = EncodedFile.new(path)
end

Instance Method Details

#read_entry(pos) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/epos/data-file.rb', line 11

def read_entry(pos)
  @file.seek(pos + 1)
  s = "*"
  while !@file.eof?
    t = @file.read(1024)
    break if t == nil || t == ""
    s << t
    i = s.index("\n*")
    if i
      s = s[0..i]
      break
    end
  end
  return s
end