Class: Workarea::Storefront::ProductViewModel::SkuOptions

Inherits:
Object
  • Object
show all
Defined in:
app/view_models/workarea/storefront/product_view_model/sku_options.rb

Instance Method Summary collapse

Constructor Details

#initialize(variants) ⇒ SkuOptions

Returns a new instance of SkuOptions.



5
6
7
# File 'app/view_models/workarea/storefront/product_view_model/sku_options.rb', line 5

def initialize(variants)
  @variants = variants
end

Instance Method Details

#to_aObject



9
10
11
12
13
14
15
16
# File 'app/view_models/workarea/storefront/product_view_model/sku_options.rb', line 9

def to_a
  if options.one?
    options
  else
    [[::I18n.t('workarea.storefront.products.select_options'), nil]] +
      options
  end
end