Class: Adrift::Pattern::Tags::Extension

Inherits:
Object
  • Object
show all
Defined in:
lib/adrift/pattern.rb

Overview

Pattern’s tag that allows to generally express the Attachment’s extension.

Instance Method Summary collapse

Instance Method Details

#labelObject

Portion of Pattern#string that will be replaced.



172
173
174
# File 'lib/adrift/pattern.rb', line 172

def label
  ':extension'
end

#specialize(options = {}) ⇒ Object

Attachment’s file extension. Expects options to include the Attachment (:attachment key).



178
179
180
# File 'lib/adrift/pattern.rb', line 178

def specialize(options={})
  File.extname(options[:attachment].filename.to_s).sub('.', '')
end