Class: CarrierWave::Storage::PostgresqlTable
- Inherits:
-
Abstract
- Object
- Abstract
- CarrierWave::Storage::PostgresqlTable
show all
- Defined in:
- lib/carrierwave/storage/postgresql_table.rb
Defined Under Namespace
Classes: CarrierWaveFile, File
Instance Method Summary
collapse
Instance Method Details
#cache!(new_file) ⇒ Object
19
20
21
22
23
|
# File 'lib/carrierwave/storage/postgresql_table.rb', line 19
def cache!(new_file)
f = CarrierWave::Storage::PostgresqlTable::File.new(uploader.cache_path)
f.store(new_file)
f
end
|
#clean_cache!(seconds) ⇒ Object
34
35
36
37
|
# File 'lib/carrierwave/storage/postgresql_table.rb', line 34
def clean_cache!(seconds)
time = Time.now - seconds.seconds
CarrierWaveFile.delete_all_files("updated_at < #{CarrierWaveFile.sanitize(time)}")
end
|
#delete_dir!(path) ⇒ Object
29
30
31
32
|
# File 'lib/carrierwave/storage/postgresql_table.rb', line 29
def delete_dir!(path)
end
|
#retrieve!(identifier) ⇒ Object
15
16
17
|
# File 'lib/carrierwave/storage/postgresql_table.rb', line 15
def retrieve!(identifier)
CarrierWave::Storage::PostgresqlTable::File.new(uploader.store_path(identifier))
end
|
#retrieve_from_cache!(identifier) ⇒ Object
25
26
27
|
# File 'lib/carrierwave/storage/postgresql_table.rb', line 25
def retrieve_from_cache!(identifier)
CarrierWave::Storage::PostgresqlTable::File.new(uploader.cache_path(identifier))
end
|
#store!(file) ⇒ Object
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/carrierwave/storage/postgresql_table.rb', line 4
def store!(file)
if(uploader.move_to_store && file.kind_of?(CarrierWave::Storage::PostgresqlTable::File))
file.move_to(uploader.store_path)
file
else
f = CarrierWave::Storage::PostgresqlTable::File.new(uploader.store_path)
f.store(file)
f
end
end
|