Class: SingaporeCPFCalculator::AgeGroup
- Inherits:
-
Object
- Object
- SingaporeCPFCalculator::AgeGroup
- 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
-
.get(current_date, birthdate:, has_70_up: false) ⇒ 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 - :group_above_65_to_70_years - :group_above_70_years.
Instance Method Summary collapse
-
#get ⇒ 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 - :group_above_65_to_70_years - :group_above_70_years.
-
#initialize(current_date, birthdate:, has_70_up:) ⇒ AgeGroup
constructor
A new instance of AgeGroup.
Constructor Details
#initialize(current_date, birthdate:, has_70_up:) ⇒ AgeGroup
Returns a new instance of AgeGroup.
28 29 30 31 32 |
# File 'lib/singapore_cpf_calculator/age_group.rb', line 28 def initialize(current_date, birthdate:, has_70_up:) @current_date = current_date @birthdate = birthdate @has_70_up = has_70_up end |
Class Method Details
.get(current_date, birthdate:, has_70_up: false) ⇒ 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
-
:group_above_65_to_70_years
-
:group_above_70_years.
21 22 23 |
# File 'lib/singapore_cpf_calculator/age_group.rb', line 21 def get(current_date, birthdate:, has_70_up: false) new(current_date, birthdate: birthdate, has_70_up: has_70_up).get end |
Instance Method Details
#get ⇒ 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
-
:group_above_65_to_70_years
-
:group_above_70_years.
43 44 45 46 47 48 49 50 51 |
# File 'lib/singapore_cpf_calculator/age_group.rb', line 43 def get if current_date.year <= 2015 age_grouping_for_2015_and_earlier elsif current_date.year <= 2021 || !has_70_up age_grouping_for_2016_and_later else age_grouping_for_2022_and_later end end |