Class: SingaporeCPFCalculator::CPFContribution
- Inherits:
-
Object
- Object
- SingaporeCPFCalculator::CPFContribution
- Defined in:
- lib/singapore_cpf_calculator/cpf_contribution.rb
Overview
Result object that describes the total, employee, and employer contribution.
Instance Attribute Summary collapse
- #employee ⇒ BigDecimal readonly
- #total ⇒ BigDecimal readonly
Instance Method Summary collapse
- #==(other) ⇒ TrueClass, FalseClass
-
#employer ⇒ BigDecimal
Difference between the total and employee contributions.
-
#initialize(total:, employee:) ⇒ CPFContribution
constructor
A new instance of CPFContribution.
Constructor Details
#initialize(total:, employee:) ⇒ CPFContribution
Returns a new instance of CPFContribution.
11 12 13 14 |
# File 'lib/singapore_cpf_calculator/cpf_contribution.rb', line 11 def initialize(total:, employee:) @total = total @employee = employee end |
Instance Attribute Details
#employee ⇒ BigDecimal (readonly)
7 8 9 |
# File 'lib/singapore_cpf_calculator/cpf_contribution.rb', line 7 def employee @employee end |
#total ⇒ BigDecimal (readonly)
7 8 9 |
# File 'lib/singapore_cpf_calculator/cpf_contribution.rb', line 7 def total @total end |
Instance Method Details
#==(other) ⇒ TrueClass, FalseClass
23 24 25 |
# File 'lib/singapore_cpf_calculator/cpf_contribution.rb', line 23 def ==(other) total == other.total && employee == other.employee end |
#employer ⇒ BigDecimal
Returns difference between the total and employee contributions.
17 18 19 |
# File 'lib/singapore_cpf_calculator/cpf_contribution.rb', line 17 def employer @employer ||= total - employee end |