Class: Spree::Stock::LocationSorter::Base Abstract
- Inherits:
-
Object
- Object
- Spree::Stock::LocationSorter::Base
- 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
Instance Attribute Summary collapse
-
#stock_locations ⇒ Object
readonly
Returns the value of attribute stock_locations.
Instance Method Summary collapse
-
#initialize(stock_locations) ⇒ Base
constructor
Initializes the stock location sorter.
-
#sort ⇒ Enumerable<Spree::StockLocation>
Sorts the stock locations.
Constructor Details
#initialize(stock_locations) ⇒ Base
Initializes the stock location sorter.
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_locations ⇒ Object (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
#sort ⇒ Enumerable<Spree::StockLocation>
Sorts the stock locations.
32 33 34 |
# File 'app/models/spree/stock/location_sorter/base.rb', line 32 def sort raise NotImplementedError end |