Sha256: a55b6476cf5bed8d5aae71dbf746bcf527f1e177ffd9bf6dcc8c42b635619cd8

Contents?: true

Size: 548 Bytes

Versions: 4

Compression:

Stored size: 548 Bytes

Contents

module Spree
  module Stock
    class InventoryUnitBuilder
      def initialize(order)
        @order = order
      end

      def units
        @order.line_items.map do |line_item|
          # They go through multiple splits, avoid loading the
          # association to order until needed.
          InventoryUnit.new(
            pending: true,
            line_item: line_item,
            variant: line_item.variant,
            quantity: line_item.quantity,
            order_id: @order.id
          )
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_core-3.7.0 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.0.rc3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.0.rc2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.0.rc1 app/models/spree/stock/inventory_unit_builder.rb