Class: Spree::Variants::OptionsPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/spree/variants/options_presenter.rb

Constant Summary collapse

WORDS_CONNECTOR =
', '.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(variant) ⇒ OptionsPresenter

Returns a new instance of OptionsPresenter.



10
11
12
# File 'app/presenters/spree/variants/options_presenter.rb', line 10

def initialize(variant)
  @variant = variant
end

Instance Attribute Details

#variantObject (readonly)

Returns the value of attribute variant.



6
7
8
# File 'app/presenters/spree/variants/options_presenter.rb', line 6

def variant
  @variant
end

Instance Method Details

#to_sentenceObject



14
15
16
17
18
19
20
# File 'app/presenters/spree/variants/options_presenter.rb', line 14

def to_sentence
  options = option_values
  options = sort_options(options)
  options = present_options(options)

  join_options(options)
end