Method: Paperclip::Interpolations#extension

Defined in:
lib/paperclip/interpolations.rb

#extension(attachment, style_name) ⇒ Object

Returns the extension of the file. e.g. “jpg” for “file.jpg” If the style has a format defined, it will return the format instead of the actual extension.



105
106
107
108
# File 'lib/paperclip/interpolations.rb', line 105

def extension attachment, style_name
  ((style = attachment.styles[style_name.to_s.to_sym]) && style[:format]) ||
    File.extname(attachment.original_filename).sub(/\A\.+/, "".freeze)
end