Class: Resizing::CarrierWave::Storage::Remote

Inherits:
CarrierWave::Storage::Abstract
  • Object
show all
Defined in:
lib/resizing/carrier_wave/storage/remote.rb

Overview

Instance Method Summary collapse

Instance Method Details

#cache!(new_file) ⇒ Object

def retrieve!(identifier)

super

end



25
26
27
28
29
# File 'lib/resizing/carrier_wave/storage/remote.rb', line 25

def cache!(new_file)
  f = Resizing::CarrierWave::Storage::File.new(uploader)
  f.store(new_file)
  f
end

#clean_cache!(seconds) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/resizing/carrier_wave/storage/remote.rb', line 40

def clean_cache!(seconds)
  # do nothing
  #
  # connection.directories.new(
  #   :key    => uploader.fog_directory,
  #   :public => uploader.fog_public
  # ).files.all(:prefix => uploader.cache_dir).each do |file|
  #   # generate_cache_id returns key formated TIMEINT-PID(-COUNTER)-RND
  #   time = file.key.scan(/(\d+)-\d+-\d+(?:-\d+)?/).first.map { |t| t.to_i }
  #   time = Time.at(*time)
  #   file.destroy if time < (Time.now.utc - seconds)
  # end
end

#delete_dir!(path) ⇒ Object



36
37
38
# File 'lib/resizing/carrier_wave/storage/remote.rb', line 36

def delete_dir!(path)
  # do nothing, because there's no such things as 'empty directory'
end

#remove!(file) ⇒ Object



15
16
17
18
19
# File 'lib/resizing/carrier_wave/storage/remote.rb', line 15

def remove!(file)
  f = Resizing::CarrierWave::Storage::File.new(uploader)
  f.delete(file)
  f
end

#retrieve_from_cache!(identifier) ⇒ Object



31
32
33
34
# File 'lib/resizing/carrier_wave/storage/remote.rb', line 31

def retrieve_from_cache!(identifier)
  # NOP
  # Resizing::CarrierWave::Storage::File..new(uploader, uploader.cache_path(identifier))
end

#store!(file) ⇒ Object



9
10
11
12
13
# File 'lib/resizing/carrier_wave/storage/remote.rb', line 9

def store!(file)
  f = Resizing::CarrierWave::Storage::File.new(uploader)
  f.store(file)
  f
end