Class: Adrift::Pattern::Tags::Basename
- Inherits:
-
Object
- Object
- Adrift::Pattern::Tags::Basename
- Defined in:
- lib/adrift/pattern.rb
Overview
Pattern’s tag that allows to generally express the Attachment’s file base name.
Instance Method Summary collapse
-
#label ⇒ Object
Portion of Pattern#string that will be replaced.
-
#specialize(options = {}) ⇒ Object
Attachment’s file base name.
Instance Method Details
#label ⇒ Object
Portion of Pattern#string that will be replaced.
156 157 158 |
# File 'lib/adrift/pattern.rb', line 156 def label ':basename' end |
#specialize(options = {}) ⇒ Object
Attachment’s file base name. Expects options
to include the Attachment (:attachment
key).
162 163 164 165 |
# File 'lib/adrift/pattern.rb', line 162 def specialize(={}) filename = [:attachment].filename.to_s filename.sub(File.extname(filename), '') end |