Module: SingaporeCPFCalculator::CitizenOrSPR3Common

Included in:
Year2014::CitizenOrSPR3, Year2015::CitizenOrSPR3, Year2016::CitizenOrSPR3
Defined in:
lib/singapore_cpf_calculator/citizen_or_spr_3_common.rb

Overview

Contains the calculators that are used for determining CPF contribution for 2014.

Instance Method Summary collapse

Instance Method Details

#applies_to?(status:, current_date:, spr_start_date:, employee_contribution_type:, employer_contribution_type:) ⇒ true, false

Parameters:

  • status: (String)
    “citizen”, “permanent_resident”, “foreigner”
  • current_date: (Date)

    current date used to determine permanent residency’s duration

  • spr_start_date: (Date)

    date when the permanent residency started

  • employee_contribution_type: (String)
    “full”, “graduated”
  • employer_contribution_type: (String)
    “full”, “graduated”

Returns:

  • (true, false)


11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/singapore_cpf_calculator/citizen_or_spr_3_common.rb', line 11

def applies_to?(
  status:,
  current_date:,
  spr_start_date:,
  employee_contribution_type:,
  employer_contribution_type:
)
  status == "citizen" || (
  status == "permanent_resident" && (
  SPRStatus.get(current_date, status_start_date: spr_start_date) == :SPR3 ||
    (employee_contribution_type == "full" && employer_contribution_type == "full")
  )
  )
end