Class: SingaporeCPFCalculator::AgeGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/singapore_cpf_calculator/age_group.rb

Overview

The contribution rates in respect of an employee above 35, 50, 55, 60 or 65 years of age shall be applied from the first day of the month after the month of his 35th, 50th, 55th, 60th or 65th birthday.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(current_date, birthdate:) ⇒ AgeGroup

Returns a new instance of AgeGroup.

Parameters:

  • current_date (Date)
  • birthdate: (Date)


26
27
28
29
# File 'lib/singapore_cpf_calculator/age_group.rb', line 26

def initialize(current_date, birthdate:)
  @current_date = current_date
  @birthdate = birthdate
end

Class Method Details

.get(current_date, birthdate:) ⇒ Symbol

Returns the symbol representation of the age group

  • :group_50_years_and_below

  • :group_55_years_and_below

  • :group_above_50_to_55_years

  • :group_above_55_to_60_years

  • :group_above_60_to_65_years

  • :group_above_65_years.

Parameters:

  • current_date (Date)
  • birthdate (Date)

Returns:

  • (Symbol)

    the symbol representation of the age group

    • :group_50_years_and_below

    • :group_55_years_and_below

    • :group_above_50_to_55_years

    • :group_above_55_to_60_years

    • :group_above_60_to_65_years

    • :group_above_65_years



19
20
21
# File 'lib/singapore_cpf_calculator/age_group.rb', line 19

def get(current_date, birthdate:)
  new(current_date, birthdate: birthdate).get
end

Instance Method Details

#getSymbol

Returns the symbol representation of the age group

  • :group_50_years_and_below

  • :group_55_years_and_below

  • :group_above_50_to_55_years

  • :group_above_55_to_60_years

  • :group_above_60_to_65_years

  • :group_above_65_years.

Returns:

  • (Symbol)

    the symbol representation of the age group

    • :group_50_years_and_below

    • :group_55_years_and_below

    • :group_above_50_to_55_years

    • :group_above_55_to_60_years

    • :group_above_60_to_65_years

    • :group_above_65_years



38
39
40
41
42
43
44
# File 'lib/singapore_cpf_calculator/age_group.rb', line 38

def get
  if current_date.year <= 2015
    age_grouping_for_2015_and_earlier
  else
    age_grouping_for_2016_and_later
  end
end