Class: Piggybak::TaxMethod
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Piggybak::TaxMethod
- Defined in:
- app/models/piggybak/tax_method.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.calculate_tax(object) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/models/piggybak/tax_method.rb', line 29 def self.calculate_tax(object) total_tax = 0 TaxMethod.all.each do |tax_method| calculator = tax_method.klass.constantize if calculator.available?(tax_method, object) total_tax += calculator.rate(tax_method, object) end end ((100*total_tax.to_f).to_i).to_f/(100.to_f) end |
Instance Method Details
#admin_label ⇒ Object
42 43 44 |
# File 'app/models/piggybak/tax_method.rb', line 42 def admin_label self.description end |
#klass_enum ⇒ Object
25 26 27 |
# File 'app/models/piggybak/tax_method.rb', line 25 def klass_enum Piggybak.config.tax_calculators end |