Class: CarrierWave::Storage::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/carrierwave/storage/abstract.rb

Overview

This file serves mostly as a specification for Storage engines. There is no requirement that storage engines must be a subclass of this class.

Direct Known Subclasses

File, Fog

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uploader) ⇒ Abstract

Returns a new instance of Abstract.



12
13
14
# File 'lib/carrierwave/storage/abstract.rb', line 12

def initialize(uploader)
  @uploader = uploader
end

Instance Attribute Details

#uploaderObject (readonly)

Returns the value of attribute uploader.



10
11
12
# File 'lib/carrierwave/storage/abstract.rb', line 10

def uploader
  @uploader
end

Instance Method Details

#cache!(new_file) ⇒ Object

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/carrierwave/storage/abstract.rb', line 26

def cache!(new_file)
  raise NotImplementedError, "Need to implement #cache! if you want to use #{self.class.name} as a cache storage."
end

#clean_cache!(seconds) ⇒ Object

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/carrierwave/storage/abstract.rb', line 38

def clean_cache!(seconds)
  raise NotImplementedError, "Need to implement #clean_cache! if you want to use #{self.class.name} as a cache storage."
end

#delete_dir!(path) ⇒ Object

Raises:

  • (NotImplementedError)


34
35
36
# File 'lib/carrierwave/storage/abstract.rb', line 34

def delete_dir!(path)
  raise NotImplementedError, "Need to implement #delete_dir! if you want to use #{self.class.name} as a cache storage."
end

#identifierObject



16
17
18
# File 'lib/carrierwave/storage/abstract.rb', line 16

def identifier
  uploader.deduplicated_filename
end

#retrieve!(identifier) ⇒ Object



23
24
# File 'lib/carrierwave/storage/abstract.rb', line 23

def retrieve!(identifier)
end

#retrieve_from_cache!(identifier) ⇒ Object

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/carrierwave/storage/abstract.rb', line 30

def retrieve_from_cache!(identifier)
  raise NotImplementedError, "Need to implement #retrieve_from_cache! if you want to use #{self.class.name} as a cache storage."
end

#store!(file) ⇒ Object



20
21
# File 'lib/carrierwave/storage/abstract.rb', line 20

def store!(file)
end