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.
6 7 8 9 10 11 12 |
# File 'app/models/spree/stock/differentiator.rb', line 6 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.
4 5 6 |
# File 'app/models/spree/stock/differentiator.rb', line 4 def missing @missing end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
4 5 6 |
# File 'app/models/spree/stock/differentiator.rb', line 4 def order @order end |
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
4 5 6 |
# File 'app/models/spree/stock/differentiator.rb', line 4 def packages @packages end |
#packed ⇒ Object (readonly)
Returns the value of attribute packed.
4 5 6 |
# File 'app/models/spree/stock/differentiator.rb', line 4 def packed @packed end |
#required ⇒ Object (readonly)
Returns the value of attribute required.
4 5 6 |
# File 'app/models/spree/stock/differentiator.rb', line 4 def required @required end |
Instance Method Details
#missing? ⇒ Boolean
14 15 16 |
# File 'app/models/spree/stock/differentiator.rb', line 14 def missing? missing.values.any? { |v| v > 0 } end |