class SingaporeCPFCalculator::CPFContribution
Result object that describes the total, employee, and employer contribution.
Attributes
aw_subject_to_cpf[R]
@return [BigDecimal]
employee[R]
@return [BigDecimal]
ow_subject_to_cpf[R]
@return [BigDecimal]
total[R]
@return [BigDecimal]
Public Class Methods
new(total:, employee:, ow_subject_to_cpf:, aw_subject_to_cpf:)
click to toggle source
@param [BigDecimal] total the total contribution amount @param [BigDecimal] employee the employee contribution amount @param [BigDecimal] ow_subject_to_cpf
Ordinary Wages which were subject to CPF @param [BigDecimal] aw_subject_to_cpf
Additional Wages which were subject to CPF
# File lib/singapore_cpf_calculator/cpf_contribution.rb, line 13 def initialize(total:, employee:, ow_subject_to_cpf:, aw_subject_to_cpf:) @total = total @employee = employee @ow_subject_to_cpf = ow_subject_to_cpf @aw_subject_to_cpf = aw_subject_to_cpf end
Public Instance Methods
==(other)
click to toggle source
@param [CPFContribution] other @return [TrueClass, FalseClass]
# File lib/singapore_cpf_calculator/cpf_contribution.rb, line 27 def ==(other) other.kind_of?(CPFContribution) && total == other.total && employee == other.employee && (ow_subject_to_cpf == other.ow_subject_to_cpf) && (aw_subject_to_cpf == other.aw_subject_to_cpf) end
employer()
click to toggle source
@return [BigDecimal] difference between the total and employee contributions
# File lib/singapore_cpf_calculator/cpf_contribution.rb, line 21 def employer @employer ||= total - employee end
inspect()
click to toggle source
# File lib/singapore_cpf_calculator/cpf_contribution.rb, line 33 def inspect {total: total.to_s, employee: employee.to_s, ow_subject_to_cpf: ow_subject_to_cpf.to_s, aw_subject_to_cpf: aw_subject_to_cpf.to_s}.to_json end