Class: Spree::Variants::OptionTypesPresenter
- Inherits:
-
Object
- Object
- Spree::Variants::OptionTypesPresenter
- Defined in:
- app/presenters/spree/variants/option_types_presenter.rb
Instance Method Summary collapse
- #default_variant ⇒ Object
-
#initialize(option_types, variants, product) ⇒ OptionTypesPresenter
constructor
A new instance of OptionTypesPresenter.
- #options ⇒ Object
Constructor Details
#initialize(option_types, variants, product) ⇒ OptionTypesPresenter
Returns a new instance of OptionTypesPresenter.
4 5 6 7 8 |
# File 'app/presenters/spree/variants/option_types_presenter.rb', line 4 def initialize(option_types, variants, product) @option_types = option_types @variant_ids = variants.map(&:id) @product = product end |
Instance Method Details
#default_variant ⇒ Object
10 11 12 |
# File 'app/presenters/spree/variants/option_types_presenter.rb', line 10 def default_variant default_variant_data[:variant] end |
#options ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/presenters/spree/variants/option_types_presenter.rb', line 14 def option_types.map do |option_type| { id: option_type.id, name: option_type.name, presentation: option_type.presentation, position: option_type.position, option_values: (option_type.option_values) } end end |