Module: CarrierWave::Uploader::Proxy

Included in:
Base
Defined in:
lib/carrierwave/uploader/proxy.rb

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Returns

Boolean

Whether the uploaded file is blank

Returns:

  • (Boolean)


12
13
14
# File 'lib/carrierwave/uploader/proxy.rb', line 12

def blank?
  file.blank?
end

#current_pathObject Also known as: path

Returns

String

the path where the file is currently located.



21
22
23
# File 'lib/carrierwave/uploader/proxy.rb', line 21

def current_path
  file.path if file.respond_to?(:path)
end

#identifierObject

Returns a string that uniquely identifies the last stored file

Returns

String

uniquely identifies a file



34
35
36
# File 'lib/carrierwave/uploader/proxy.rb', line 34

def identifier
  storage.identifier if storage.respond_to?(:identifier)
end

#readObject

Read the contents of the file

Returns

String

contents of the file



45
46
47
# File 'lib/carrierwave/uploader/proxy.rb', line 45

def read
  file.read if file.respond_to?(:read)
end

#sizeObject

Fetches the size of the currently stored/cached file

Returns

Integer

size of the file



56
57
58
# File 'lib/carrierwave/uploader/proxy.rb', line 56

def size
  file.respond_to?(:size) ? file.size : 0
end