Class: Epos::IndexedDataFile
- Inherits:
-
Object
- Object
- Epos::IndexedDataFile
- Defined in:
- lib/epos/indexed-data-file.rb
Instance Method Summary collapse
- #has_key?(key) ⇒ Boolean
-
#initialize(index_path, data_path) ⇒ IndexedDataFile
constructor
A new instance of IndexedDataFile.
- #keys ⇒ Object
- #look_up(key) ⇒ Object
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
20 21 22 |
# File 'lib/epos/indexed-data-file.rb', line 20 def has_key?(key) @index.has_key?(key) end |
#keys ⇒ Object
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 |