Module: SingaporeCharitableDonations::Calculators::MBMF::Year2009Calculator
- Defined in:
- lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb
Overview
Mosque Building and Mendaki Fund contribution calculator for the year 2009 onwards.
Class Method Summary collapse
- .applies_to?(date, type) ⇒ TrueClass, FalseClass
-
.calculate(total_wages) ⇒ BigDecimal
Contribution amount.
Class Method Details
.applies_to?(date, type) ⇒ TrueClass, FalseClass
32 33 34 |
# File 'lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb', line 32 def applies_to?(date, type) date.year >= 2009 && type == 'MBMF' end |
.calculate(total_wages) ⇒ BigDecimal
Returns contribution amount.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb', line 11 def calculate(total_wages) rounded_total_wages = total_wages.round case when rounded_total_wages <= 200.00 BigDecimal "0.00" when rounded_total_wages <= 1_000.00 BigDecimal "2.00" when rounded_total_wages <= 2_000.00 BigDecimal "3.50" when rounded_total_wages <= 3_000.00 BigDecimal "5.00" when rounded_total_wages <= 4_000.00 BigDecimal "12.50" else # total_wages > 4_000.00 BigDecimal "16.00" end end |