Sha256: efe61493e1189ebf28531c14d83d44ee0ef6efa47143fda4bdbef76a21fe6c19

Contents?: true

Size: 481 Bytes

Versions: 2

Compression:

Stored size: 481 Bytes

Contents

module Workarea
  module Storefront
    class ProductTemplates::VariantListViewModel < ProductViewModel
      delegate :all_options, to: :option_set

      def variant_list
        @variant_list ||= variants.map do |variant|
          VariantViewModel.new(
            variant,
            options.merge(inventory: inventory)
          )
        end
      end

      def option_set
        @option_set ||= ProductViewModel::OptionSet.new(self, options)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-variant_list-1.0.3 app/view_models/workarea/storefront/product_templates/variant_list_view_model.rb
workarea-variant_list-1.0.2 app/view_models/workarea/storefront/product_templates/variant_list_view_model.rb