Class: Kabutops::CrawlerExtensions::PStoreStorage::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/kabutops/crawler_extensions/pstore_storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(path = '.kabutopus.config.pstore') ⇒ Storage

Returns a new instance of Storage.



11
12
13
# File 'lib/kabutops/crawler_extensions/pstore_storage.rb', line 11

def initialize path='.kabutopus.config.pstore'
  @storage ||= PStore.new(path)
end

Instance Method Details

#[](key) ⇒ Object



15
16
17
# File 'lib/kabutops/crawler_extensions/pstore_storage.rb', line 15

def [] key
  @storage.transaction { @storage[key.to_sym] }
end

#[]=(key, value) ⇒ Object



19
20
21
22
23
# File 'lib/kabutops/crawler_extensions/pstore_storage.rb', line 19

def []= key, value
  @storage.transaction do
    @storage[key.to_sym] = value
  end
end