Class: Stockman::Logic::Product::SellablesCollection
- Inherits:
-
Object
- Object
- Stockman::Logic::Product::SellablesCollection
- Includes:
- Enumerable
- Defined in:
- lib/stockman/logic/product/sellables_collection.rb
Instance Attribute Summary collapse
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(product_id) ⇒ SellablesCollection
constructor
A new instance of SellablesCollection.
- #sellables ⇒ Object
- #stock_levels ⇒ Object
Constructor Details
#initialize(product_id) ⇒ SellablesCollection
Returns a new instance of SellablesCollection.
9 10 11 |
# File 'lib/stockman/logic/product/sellables_collection.rb', line 9 def initialize(product_id) @product_id = product_id end |
Instance Attribute Details
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
7 8 9 |
# File 'lib/stockman/logic/product/sellables_collection.rb', line 7 def product_id @product_id end |
Instance Method Details
#each ⇒ Object
21 22 23 |
# File 'lib/stockman/logic/product/sellables_collection.rb', line 21 def each sellables.each{ |sellable| yield sellable } end |
#sellables ⇒ Object
13 14 15 |
# File 'lib/stockman/logic/product/sellables_collection.rb', line 13 def sellables @sellables ||= load_sellables end |
#stock_levels ⇒ Object
17 18 19 |
# File 'lib/stockman/logic/product/sellables_collection.rb', line 17 def stock_levels @stock_levels ||= sellables.map(&:stock_levels).flatten.map(&:stock_levels).flatten end |