Class: Spree::Calculator::FlatRate

Inherits:
Spree::Calculator show all
Defined in:
app/models/spree/calculator/flat_rate.rb

Instance Method Summary (collapse)

Methods inherited from Spree::Calculator

#available?, calculators, 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(object = nil)



8
9
10
11
12
13
14
# File 'app/models/spree/calculator/flat_rate.rb', line 8

def compute(object = nil)
  if object && preferred_currency.casecmp(object.currency).zero?
    preferred_amount
  else
    0
  end
end