Module: SingaporeCharitableDonations::Calculators::CDAC::Year2014Calculator

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

Overview

Chinese Development Assistance Council (CDAC) Fund contribution calculator for 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)


23
24
25
# File 'lib/singapore_charitable_donations/calculators/cdac/year_2014_calculator.rb', line 23

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

.calculate(total_wage) ⇒ BigDecimal

Returns contribution amount.

Parameters:

  • total_wage (BigDecimal)

Returns:

  • (BigDecimal)

    contribution amount



11
12
13
14
15
16
17
18
# File 'lib/singapore_charitable_donations/calculators/cdac/year_2014_calculator.rb', line 11

def calculate(total_wage)
  case
  when total_wage < 2_000.00
    BigDecimal "0.50"
  when total_wage >= 2_000.00
    BigDecimal "1.00"
  end
end