Module: SingaporeCharitableDonations::Calculators::SINDA::Year2015Calculator

Defined in:
lib/singapore_charitable_donations/calculators/sinda/year_2015_calculator.rb

Overview

Singapore Indian Development Association Fund contribution calculator for the year 2015 onwards.

Class Method Summary collapse

Class Method Details

.applies_to?(date, type) ⇒ TrueClass, FalseClass

Parameters:

  • date (Date)

    to be considered for calculation

  • type (String)

    of charitable contribution

Returns:

  • (TrueClass, FalseClass)


35
36
37
# File 'lib/singapore_charitable_donations/calculators/sinda/year_2015_calculator.rb', line 35

def applies_to?(date, type)
  date.year >= 2015 && type == 'SINDA'
end

.calculate(total_wages) ⇒ BigDecimal

Returns contribution amount.

Parameters:

  • total_wage (BigDecimal)

Returns:

  • (BigDecimal)

    contribution amount



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/singapore_charitable_donations/calculators/sinda/year_2015_calculator.rb', line 11

def calculate(total_wages)
  case
  when total_wages <= 1_000.00
    BigDecimal "1.00"
  when total_wages <= 1_500.00
    BigDecimal "3.00"
  when total_wages <= 2_500.00
    BigDecimal "5.00"
  when total_wages <= 4_500.00
    BigDecimal "7.00"
  when total_wages <= 7_500.00
    BigDecimal "9.00"
  when total_wages <= 10_000.00
    BigDecimal "12.00"
  when total_wages <= 15_000.00
    BigDecimal "18.00"
  else # total_wages > 15_000.00
    BigDecimal "30.00"
  end
end