Module: LaserBlob::BlobHelpers

Extended by:
ActiveSupport::Concern
Included in:
Blob
Defined in:
lib/laserblob/blob_helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.filename_from_file(file) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/laserblob/blob_helpers.rb', line 21

def self.filename_from_file(file)
  fn = if file.respond_to?(:original_filename)
    file.original_filename || File.basename(file.path)
  else
    File.basename(file.path)
  end
  "#{File.basename(fn, File.extname(fn))}#{File.extname(fn)&.downcase}"
end

Instance Method Details

#file_content_type(file) ⇒ Object



13
14
15
# File 'lib/laserblob/blob_helpers.rb', line 13

def file_content_type(file)
  self.class.file_content_type(file)
end

#file_sha1(file) ⇒ Object



17
18
19
# File 'lib/laserblob/blob_helpers.rb', line 17

def file_sha1(file)
  self.class.file_sha1(file)
end