Class: Friendly::StorageFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/friendly/storage_factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_klass = DocumentTable, index_klass = Index, cache_klass = Cache) ⇒ StorageFactory

Returns a new instance of StorageFactory.



5
6
7
8
9
10
# File 'lib/friendly/storage_factory.rb', line 5

def initialize(table_klass = DocumentTable, index_klass = Index,
               cache_klass = Cache)
  @table_klass = table_klass
  @index_klass = index_klass
  @cache_klass = cache_klass
end

Instance Attribute Details

#cache_klassObject (readonly)

Returns the value of attribute cache_klass.



3
4
5
# File 'lib/friendly/storage_factory.rb', line 3

def cache_klass
  @cache_klass
end

#index_klassObject (readonly)

Returns the value of attribute index_klass.



3
4
5
# File 'lib/friendly/storage_factory.rb', line 3

def index_klass
  @index_klass
end

#table_klassObject (readonly)

Returns the value of attribute table_klass.



3
4
5
# File 'lib/friendly/storage_factory.rb', line 3

def table_klass
  @table_klass
end

Instance Method Details

#cache(*args) ⇒ Object



20
21
22
# File 'lib/friendly/storage_factory.rb', line 20

def cache(*args)
  cache_klass.cache_for(*args)
end

#document_table(*args) ⇒ Object



12
13
14
# File 'lib/friendly/storage_factory.rb', line 12

def document_table(*args)
  table_klass.new(*args)
end

#index(*args) ⇒ Object



16
17
18
# File 'lib/friendly/storage_factory.rb', line 16

def index(*args)
  index_klass.new(*args)
end