Class: Bumbleworks::StorageAdapter
- Inherits:
-
Object
- Object
- Bumbleworks::StorageAdapter
show all
- Defined in:
- lib/bumbleworks/storage_adapter.rb
Defined Under Namespace
Classes: UnsupportedStorage
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.auto_register ⇒ Object
Returns the value of attribute auto_register.
5
6
7
|
# File 'lib/bumbleworks/storage_adapter.rb', line 5
def auto_register
@auto_register
end
|
Class Method Details
.allow_history_storage? ⇒ Boolean
37
38
39
|
# File 'lib/bumbleworks/storage_adapter.rb', line 37
def allow_history_storage?
true
end
|
.auto_register? ⇒ Boolean
7
8
9
|
# File 'lib/bumbleworks/storage_adapter.rb', line 7
def auto_register?
auto_register.nil? || auto_register == true
end
|
.display_name ⇒ Object
33
34
35
|
# File 'lib/bumbleworks/storage_adapter.rb', line 33
def display_name
storage_class.name
end
|
.driver ⇒ Object
11
12
13
|
# File 'lib/bumbleworks/storage_adapter.rb', line 11
def driver
raise "Subclass responsibility"
end
|
.new_storage(storage, options = {}) ⇒ Object
15
16
17
18
|
# File 'lib/bumbleworks/storage_adapter.rb', line 15
def new_storage(storage, options = {})
raise UnsupportedStorage unless use?(storage)
wrap_storage_with_driver(storage, options)
end
|
.storage_class ⇒ Object
29
30
31
|
# File 'lib/bumbleworks/storage_adapter.rb', line 29
def storage_class
raise "Subclass responsibility"
end
|
.use?(storage) ⇒ Boolean
25
26
27
|
# File 'lib/bumbleworks/storage_adapter.rb', line 25
def use?(storage)
storage.is_a? storage_class
end
|
.wrap_storage_with_driver(storage, options = {}) ⇒ Object
20
21
22
23
|
# File 'lib/bumbleworks/storage_adapter.rb', line 20
def wrap_storage_with_driver(storage, options = {})
driver.new(storage)
end
|