Class: Spree::Calculator::Shipping::PriceSack

Inherits:
ShippingCalculator show all
Defined in:
app/models/spree/calculator/shipping/price_sack.rb

Instance Method Summary (collapse)

Methods inherited from ShippingCalculator

#available?, #compute_shipment

Methods inherited from Spree::Calculator

#available?, calculators, #compute, description, #description, register, #to_s

Methods inherited from Base

display_includes, #initialize_preference_defaults, page, preference

Methods included from Preferences::Preferable

#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference

Instance Method Details

- (Object) compute_from_price(price)



15
16
17
18
19
20
21
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 15

def compute_from_price(price)
  if price < preferred_minimal_amount
    preferred_normal_amount
  else
    preferred_discount_amount
  end
end

- (Object) compute_package(package)



11
12
13
# File 'app/models/spree/calculator/shipping/price_sack.rb', line 11

def compute_package(package)
  compute_from_price(total(package.contents))
end