Class: ActiveStorage::NamedVariant
- Inherits:
-
Object
- Object
- ActiveStorage::NamedVariant
- Defined in:
- app/models/active_storage/named_variant.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#preprocessed ⇒ Object
readonly
Returns the value of attribute preprocessed.
-
#transformations ⇒ Object
readonly
Returns the value of attribute transformations.
Instance Method Summary collapse
-
#initialize(transformations) ⇒ NamedVariant
constructor
A new instance of NamedVariant.
- #preprocessed?(record) ⇒ Boolean
Constructor Details
#initialize(transformations) ⇒ NamedVariant
Returns a new instance of NamedVariant.
6 7 8 9 |
# File 'app/models/active_storage/named_variant.rb', line 6 def initialize(transformations) @preprocessed = transformations[:preprocessed] @transformations = transformations.except(:preprocessed) end |
Instance Attribute Details
#preprocessed ⇒ Object (readonly)
Returns the value of attribute preprocessed.
4 5 6 |
# File 'app/models/active_storage/named_variant.rb', line 4 def preprocessed @preprocessed end |
#transformations ⇒ Object (readonly)
Returns the value of attribute transformations.
4 5 6 |
# File 'app/models/active_storage/named_variant.rb', line 4 def transformations @transformations end |
Instance Method Details
#preprocessed?(record) ⇒ Boolean
11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/active_storage/named_variant.rb', line 11 def preprocessed?(record) case preprocessed when Symbol record.send(preprocessed) when Proc preprocessed.call(record) else preprocessed end end |