Class: Yoda::Store::Adapters::LazyAdapter

Inherits:
Base
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/yoda/store/adapters/lazy_adapter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#batch_write, #clear, #delete, #empty?, #exist?, #get, #inspect, #keys, #namespace, #persistable?, #put, #stats, #sync

Constructor Details

#initialize(path) ⇒ LazyAdapter

Returns a new instance of LazyAdapter.

Parameters:

  • path (String)

    represents the path to store db.



23
24
25
# File 'lib/yoda/store/adapters/lazy_adapter.rb', line 23

def initialize(path)
  @path = path
end

Class Method Details

.for(path, type) ⇒ Object



8
9
10
11
# File 'lib/yoda/store/adapters/lazy_adapter.rb', line 8

def for(path, type)
  @pool ||= {}
  @pool[path] || (@pool[path] = new(path))
end

.typeObject



13
14
15
# File 'lib/yoda/store/adapters/lazy_adapter.rb', line 13

def type
  :lazy
end

Instance Method Details

#adapterAdapters::Base

Returns:



28
29
30
# File 'lib/yoda/store/adapters/lazy_adapter.rb', line 28

def adapter
  @adapter ||= Adapters.for(path)
end