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

- (Abstract) initialize(uploader)

Returns a new instance of Abstract



14
15
16
# File 'lib/carrierwave/storage/abstract.rb', line 14

def initialize(uploader)
  @uploader = uploader
end

Instance Attribute Details

- (Object) uploader (readonly)

Returns the value of attribute uploader



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

def uploader
  @uploader
end

Instance Method Details

- (Object) cache!(new_file)

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/carrierwave/storage/abstract.rb', line 28

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

- (Object) clean_cache!(seconds)

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/carrierwave/storage/abstract.rb', line 40

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

- (Object) delete_dir!(path)

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/carrierwave/storage/abstract.rb', line 36

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

- (Object) identifier



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

def identifier
  uploader.filename
end

- (Object) retrieve!(identifier)



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

def retrieve!(identifier)
end

- (Object) retrieve_from_cache!(identifier)

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/carrierwave/storage/abstract.rb', line 32

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

- (Object) store!(file)



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

def store!(file)
end