Module: SingaporeCharitableDonations::Calculators::SINDA::Year2014Calculator

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

Overview

Singapore Indian Development Association Fund contribution calculator for the year 2014.

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)


28
29
30
# File 'lib/singapore_charitable_donations/calculators/sinda/year_2014_calculator.rb', line 28

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

.calculate(total_wages) ⇒ BigDecimal

Returns contribution amount.

Parameters:

  • total_wage (BigDecimal)

Returns:

  • (BigDecimal)

    contribution amount



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/singapore_charitable_donations/calculators/sinda/year_2014_calculator.rb', line 12

def calculate(total_wages)
  case
  when total_wages <= 600.00
    BigDecimal "1.00"
  when total_wages <= 1_500.00
    BigDecimal "3.00"
  when total_wages <= 2_500.00
    BigDecimal "5.00"
  else # > 2_500.00
    BigDecimal "7.00"
  end
end