Class: StrokeDB::InvertedListFileStorage
- Defined in:
- lib/strokedb/stores/inverted_list_file_storage.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
TODO: include ChainableStorage.
Instance Method Summary collapse
- #clear! ⇒ Object
- #find_list ⇒ Object
-
#initialize(opts = {}) ⇒ InvertedListFileStorage
constructor
A new instance of InvertedListFileStorage.
- #save!(list) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ InvertedListFileStorage
Returns a new instance of InvertedListFileStorage.
8 9 10 11 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 8 def initialize(opts={}) opts = opts.stringify_keys @path = opts['path'] end |
Instance Attribute Details
#path ⇒ Object
TODO: include ChainableStorage
6 7 8 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 6 def path @path end |
Instance Method Details
#clear! ⇒ Object
17 18 19 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 17 def clear! FileUtils.rm_rf @path end |
#find_list ⇒ Object
13 14 15 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 13 def find_list read(file_path) end |
#save!(list) ⇒ Object
21 22 23 24 |
# File 'lib/strokedb/stores/inverted_list_file_storage.rb', line 21 def save!(list) FileUtils.mkdir_p @path write(file_path, list) end |