Class: ActiveStorage::NamedVariant
- Defined in:
- activestorage/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(options) ⇒ NamedVariant
constructor
A new instance of NamedVariant.
- #process(record) ⇒ Object
Constructor Details
#initialize(options) ⇒ NamedVariant
Returns a new instance of NamedVariant.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'activestorage/app/models/active_storage/named_variant.rb', line 6 def initialize() @preprocessed = [:preprocessed] @process_option = [:process] @transformations = .except(:preprocessed, :process) if .key?(:preprocessed) ActiveStorage.deprecator.warn(<<~MSG.squish) The :preprocessed option is deprecated and will be removed in Rails 9.0. Use the :process option instead. Replace `preprocessed: true` with `process: :later` and `preprocessed: false` with `process: :lazily`. MSG end end |
Instance Attribute Details
#preprocessed ⇒ Object (readonly)
Returns the value of attribute preprocessed.
4 5 6 |
# File 'activestorage/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 'activestorage/app/models/active_storage/named_variant.rb', line 4 def transformations @transformations end |
Instance Method Details
#process(record) ⇒ Object
20 21 22 23 |
# File 'activestorage/app/models/active_storage/named_variant.rb', line 20 def process(record) return @process_option if @process_option preprocessed?(record) ? :later : :lazily end |