Module: CarrierWave::Utilities::FileName

Included in:
SanitizedFile, Storage::Fog::File
Defined in:
lib/carrierwave/utilities/file_name.rb

Instance Method Summary collapse

Instance Method Details

#basenameObject

Returns the part of the filename before the extension. So if a file is called 'test.jpeg' this would return 'test'

Returns

String

the first part of the filename


13
14
15
# File 'lib/carrierwave/utilities/file_name.rb', line 13

def basename
  split_extension(filename)[0] if filename
end

#extensionObject

Returns the file extension

Returns

String

extension of file or “” if the file has no extension


24
25
26
# File 'lib/carrierwave/utilities/file_name.rb', line 24

def extension
  split_extension(filename)[1] if filename
end