Sha256: fd77e91011971501a3e63044630f6b6a815b593d8622f9a93ced8225eb9c8c48
Contents?: true
Size: 712 Bytes
Versions: 2
Compression:
Stored size: 712 Bytes
Contents
require_relative "product/sellables_collection" require_relative "product/stock_level" require_relative "product/stock_levels_collection" module Stockman module Logic class Product attr_reader :id def initialize(id) @id = id end def total_physical_amount stock_levels.sum(&:physical_amount) end def total_allocated_amount stock_levels.sum(&:allocated_amount) end def total_available_amount stock_levels.sum(&:available_amount) end def stock_levels @stock_levels ||= StockLevelsCollection.new(id) end def summary @summary ||= Summary.from_object(self) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stockman-logic-0.1.1 | lib/stockman/logic/product.rb |
stockman-logic-0.1.0 | lib/stockman/logic/product.rb |