Module: SingaporeCPFCalculator::BeforeSPR

Defined in:
lib/singapore_cpf_calculator/before_spr.rb

Overview

Residency module for Singaporean Permanent Residents before theirs status effectivity.

Class Method Summary collapse

Class Method Details

.applies_to?(status:, current_date:, spr_start_date:) ⇒ 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

Returns:

  • (true, false)


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

def applies_to?(
  status:,
  current_date:,
  spr_start_date:,
  **
)
  status == "permanent_resident" && (
    spr_start_date.year > current_date.year ||
      (spr_start_date.year == current_date.year && spr_start_date.month > current_date.month)
  )
end

.calculator_for(current_date, birthdate:) ⇒ #calculator

Returns the CPF calculator that matches the age.

Parameters:

  • current_date (Object)
  • birthdate (Object)

Returns:

  • (#calculator)

    returns the CPF calculator that matches the age.



29
30
31
# File 'lib/singapore_cpf_calculator/before_spr.rb', line 29

def calculator_for(current_date, birthdate:)
  NullContributionCalculator
end