Class: Friendly::StorageFactory
- Inherits:
-
Object
- Object
- Friendly::StorageFactory
- Defined in:
- lib/friendly/storage_factory.rb
Instance Attribute Summary collapse
-
#cache_klass ⇒ Object
readonly
Returns the value of attribute cache_klass.
-
#index_klass ⇒ Object
readonly
Returns the value of attribute index_klass.
-
#table_klass ⇒ Object
readonly
Returns the value of attribute table_klass.
Instance Method Summary collapse
- #cache(*args) ⇒ Object
- #document_table(*args) ⇒ Object
- #index(*args) ⇒ Object
-
#initialize(table_klass = DocumentTable, index_klass = Index, cache_klass = Cache) ⇒ StorageFactory
constructor
A new instance of StorageFactory.
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_klass ⇒ Object (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_klass ⇒ Object (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_klass ⇒ Object (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 |