Class: Epos::IndexedDataFile

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

Instance Method Summary collapse

Constructor Details

#initialize(index_path, data_path) ⇒ IndexedDataFile

Returns a new instance of IndexedDataFile.



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

def initialize(index_path, data_path)
  @index = IndexFile.new(index_path)
  @data  = DataFile.new(data_path)
end

Instance Method Details

#has_key?(key) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/epos/indexed-data-file.rb', line 20

def has_key?(key)
  @index.has_key?(key)
end

#keysObject



16
17
18
# File 'lib/epos/indexed-data-file.rb', line 16

def keys
  @index.keys
end

#look_up(key) ⇒ Object



12
13
14
# File 'lib/epos/indexed-data-file.rb', line 12

def look_up(key)
  @index.look_up(key).map{|pos| @data.read_entry(pos)}
end