Class: Spree::Stock::Differentiator
- Inherits:
-
Object
- Object
- Spree::Stock::Differentiator
- Defined in:
- app/models/spree/stock/differentiator.rb
Instance Attribute Summary collapse
-
#missing ⇒ Object
readonly
Returns the value of attribute missing.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
-
#packed ⇒ Object
readonly
Returns the value of attribute packed.
-
#required ⇒ Object
readonly
Returns the value of attribute required.
Instance Method Summary collapse
-
#initialize(order, packages) ⇒ Differentiator
constructor
A new instance of Differentiator.
- #missing? ⇒ Boolean
Constructor Details
#initialize(order, packages) ⇒ Differentiator
Returns a new instance of Differentiator.
8 9 10 11 12 13 14 |
# File 'app/models/spree/stock/differentiator.rb', line 8 def initialize(order, packages) @order = order @packages = packages build_packed build_required build_missing end |
Instance Attribute Details
#missing ⇒ Object (readonly)
Returns the value of attribute missing.
6 7 8 |
# File 'app/models/spree/stock/differentiator.rb', line 6 def missing @missing end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
6 7 8 |
# File 'app/models/spree/stock/differentiator.rb', line 6 def order @order end |
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
6 7 8 |
# File 'app/models/spree/stock/differentiator.rb', line 6 def packages @packages end |
#packed ⇒ Object (readonly)
Returns the value of attribute packed.
6 7 8 |
# File 'app/models/spree/stock/differentiator.rb', line 6 def packed @packed end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
6 7 8 |
# File 'app/models/spree/stock/differentiator.rb', line 6 def required @required end |
Instance Method Details
#missing? ⇒ Boolean
16 17 18 |
# File 'app/models/spree/stock/differentiator.rb', line 16 def missing? missing.values.any? { |value| value > 0 } end |