Class: Calculator::PerItem
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Calculator
#available?, calculators, #description, #to_s
Class Method Details
.description ⇒ Object
4
5
6
|
# File 'app/models/calculator/per_item.rb', line 4
def self.description
I18n.t("flat_rate_per_item")
end
|
8
9
10
11
12
13
|
# File 'app/models/calculator/per_item.rb', line 8
def self.register
super
Coupon.register_calculator(self)
ShippingMethod.register_calculator(self)
ShippingRate.register_calculator(self)
end
|
Instance Method Details
#compute(object = nil) ⇒ Object
15
16
17
|
# File 'app/models/calculator/per_item.rb', line 15
def compute(object=nil)
self.preferred_amount * object.length
end
|