Class: Spree::Stock::LocationSorter::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/stock/location_sorter/base.rb

Overview

This class is abstract.

To implement your own location sorter, subclass and implement #sort.

Stock location sorters are used to determine the order in which inventory units will be allocated when packaging a shipment.

This allows you, for example, to allocate inventory from the default stock location first.

Direct Known Subclasses

DefaultFirst, Unsorted

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stock_locations) ⇒ Base

Initializes the stock location sorter.

Parameters:



24
25
26
# File 'app/models/spree/stock/location_sorter/base.rb', line 24

def initialize(stock_locations)
  @stock_locations = stock_locations
end

Instance Attribute Details

#stock_locationsObject (readonly)

Returns the value of attribute stock_locations.



18
19
20
# File 'app/models/spree/stock/location_sorter/base.rb', line 18

def stock_locations
  @stock_locations
end

Instance Method Details

#sortEnumerable<Spree::StockLocation>

Sorts the stock locations.

Returns:

Raises:

  • (NotImplementedError)


32
33
34
# File 'app/models/spree/stock/location_sorter/base.rb', line 32

def sort
  raise NotImplementedError
end