class Paperclip::AbstractAdapter

Constants

OS_RESTRICTED_CHARACTERS

Attributes

content_type[R]
length[R]
original_filename[R]
size[R]

Public Instance Methods

assignment?() click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 32
def assignment?
  true
end
fingerprint() click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 11
def fingerprint
  @fingerprint ||= Digest::MD5.file(path).to_s
end
inspect() click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 19
def inspect
  "#{self.class}: #{self.original_filename}"
end
nil?() click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 28
def nil?
  false
end
original_filename=(new_filename) click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 23
def original_filename=(new_filename)
  return unless new_filename
  @original_filename = new_filename.gsub(OS_RESTRICTED_CHARACTERS, "_")
end
read(length = nil, buffer = nil) click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 15
def read(length = nil, buffer = nil)
  @tempfile.read(length, buffer)
end

Private Instance Methods

copy_to_tempfile(src) click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 42
def copy_to_tempfile(src)
  FileUtils.cp(src.path, destination.path)
  destination
end
destination() click to toggle source
# File lib/paperclip/io_adapters/abstract_adapter.rb, line 38
def destination
  @destination ||= TempfileFactory.new.generate(@original_filename.to_s)
end