Class: Spree::Calculator::Shipping::PerItem
- Inherits:
-
ShippingCalculator
- Object
- ActiveRecord::Base
- Base
- Spree::Calculator
- ShippingCalculator
- Spree::Calculator::Shipping::PerItem
- Defined in:
- app/models/spree/calculator/shipping/per_item.rb
Instance Method Summary collapse
Methods inherited from ShippingCalculator
Methods inherited from Spree::Calculator
#available?, #compute, description, #description, #to_s
Methods inherited from Base
Methods included from Spree::Core::Permalinks
#generate_permalink, #save_permalink
Instance Method Details
#compute_from_quantity(quantity) ⇒ Object
16 17 18 |
# File 'app/models/spree/calculator/shipping/per_item.rb', line 16 def compute_from_quantity(quantity) preferred_amount * quantity end |
#compute_package(package) ⇒ Object
12 13 14 |
# File 'app/models/spree/calculator/shipping/per_item.rb', line 12 def compute_package(package) compute_from_quantity(package.contents.sum(&:quantity)) end |