Class: CarrierWave::Storage::Aliyun

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

Instance Method Summary collapse

Instance Method Details

#cache!(new_file) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/carrierwave/storage/aliyun.rb', line 21

def cache!(new_file)
  f = AliyunFile.new(uploader, self, uploader.cache_path)
  headers = {
    content_type: new_file.content_type,
    content_disposition: uploader.try(:content_disposition)
  }

  f.store(new_file, headers)
  f
end

#delete_dir!(path) ⇒ Object



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

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

#retrieve!(identifier) ⇒ Object



17
18
19
# File 'lib/carrierwave/storage/aliyun.rb', line 17

def retrieve!(identifier)
  AliyunFile.new(uploader, self, uploader.store_path(identifier))
end

#retrieve_from_cache!(identifier) ⇒ Object



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

def retrieve_from_cache!(identifier)
  AliyunFile.new(uploader, self, uploader.cache_path(identifier))
end

#store!(new_file) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/carrierwave/storage/aliyun.rb', line 6

def store!(new_file)
  f = AliyunFile.new(uploader, self, uploader.store_path)
  headers = {
    content_type: new_file.content_type,
    content_disposition: uploader.try(:content_disposition)
  }

  f.store(new_file, headers)
  f
end