Class: Ratonvirus::Storage::Base
- Inherits:
-
Object
- Object
- Ratonvirus::Storage::Base
show all
- Defined in:
- lib/ratonvirus/storage/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(configuration = {}) ⇒ Base
Returns a new instance of Base.
8
9
10
11
12
|
# File 'lib/ratonvirus/storage/base.rb', line 8
def initialize(configuration = {})
@config = configuration.dup
setup if respond_to?(:setup)
end
|
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
6
7
8
|
# File 'lib/ratonvirus/storage/base.rb', line 6
def config
@config
end
|
Instance Method Details
#accept?(_resource) ⇒ Boolean
30
31
32
|
# File 'lib/ratonvirus/storage/base.rb', line 30
def accept?(_resource)
raise NotImplementedError, "Implement accept? on #{self.class.name}"
end
|
#asset_path(_asset) ⇒ Object
34
35
36
|
# File 'lib/ratonvirus/storage/base.rb', line 34
def asset_path(_asset)
raise NotImplementedError, "Implement path on #{self.class.name}"
end
|
#asset_remove(_asset) ⇒ Object
38
39
40
|
# File 'lib/ratonvirus/storage/base.rb', line 38
def asset_remove(_asset)
raise NotImplementedError, "Implement remove on #{self.class.name}"
end
|
#changed?(_record, _attribute) ⇒ Boolean
26
27
28
|
# File 'lib/ratonvirus/storage/base.rb', line 26
def changed?(_record, _attribute)
raise NotImplementedError, "Implement changed? on #{self.class.name}"
end
|
#process(resource) ⇒ Object
Default process implementation.
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/ratonvirus/storage/base.rb', line 15
def process(resource)
return unless block_given?
return if resource.nil?
resource = [resource] unless resource.is_a?(Array)
resource.each do |asset|
yield processable(asset)
end
end
|