Class: Dragonfly::ActiveModelExtensions::Attachment
- Inherits:
-
Object
- Object
- Dragonfly::ActiveModelExtensions::Attachment
show all
- Defined in:
- lib/dragonfly/active_record_extensions/attachment.rb
Defined Under Namespace
Classes: InvaidGeometryOrStyleNameError
Instance Method Summary
collapse
Instance Method Details
#current_styles ⇒ Object
23
24
25
|
# File 'lib/dragonfly/active_record_extensions/attachment.rb', line 23
def current_styles
parent_model.class.dragonfly_styles_for_attributes[attribute_name.to_sym] || {}
end
|
#style(style_name_or_geometry, format = nil) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/dragonfly/active_record_extensions/attachment.rb', line 6
def style style_name_or_geometry, format=nil
scope = case style_name_or_geometry
when Symbol style current_styles[style_name_or_geometry], format
when String job.thumb style_name_or_geometry
when Array style *style_name_or_geometry
when Proc job.instance_eval &style_name_or_geometry
else
raise InvaidGeometryOrStyleNameError
end
scope = scope.encode(format) if format
scope
end
|