Class: AdditionalCalculator::Base
- Inherits:
-
Calculator
- Object
- Calculator
- AdditionalCalculator::Base
- Defined in:
- app/models/additional_calculator/base.rb
Direct Known Subclasses
Class Method Summary collapse
-
.register ⇒ Object
Register the calculator.
Instance Method Summary collapse
-
#name ⇒ Object
Return calculator name.
- #sorted_rates ⇒ Object
-
#supported_types ⇒ Object
supported types for the specified calculator (weight, qnty, …) all the types are supported by default.
Class Method Details
.register ⇒ Object
Register the calculator
13 14 15 16 |
# File 'app/models/additional_calculator/base.rb', line 13 def self.register super ShippingMethod.register_calculator(self) end |
Instance Method Details
#name ⇒ Object
Return calculator name
19 20 21 |
# File 'app/models/additional_calculator/base.rb', line 19 def name calculable.respond_to?(:name) ? calculable.name : calculable.to_s end |
#sorted_rates ⇒ Object
29 30 31 |
# File 'app/models/additional_calculator/base.rb', line 29 def sorted_rates additional_calculator_rates.order("rate_type ASC, from_value ASC") end |
#supported_types ⇒ Object
supported types for the specified calculator (weight, qnty, …) all the types are supported by default
25 26 27 |
# File 'app/models/additional_calculator/base.rb', line 25 def supported_types AdditionalCalculatorRate.all_types end |