Sha256: a319c02cac01e8b6aeddecddc3d0a9d9dd690d5e67a93d0e5da186da8ae8e2af

Contents?: true

Size: 739 Bytes

Versions: 2

Compression:

Stored size: 739 Bytes

Contents

module SingaporeCPFCalculator

  # Result object that describes the total, employee, and employer contribution.
  class CPFContribution

    # @return [BigDecimal]
    attr_reader :total, :employee

    # @param [BigDecimal] total the total contribution amount
    # @param [BigDecimal] employee the employee contribution amount
    def initialize(total:, employee:)
      @total = total
      @employee = employee
    end

    # @return [BigDecimal] difference between the total and employee contributions
    def employer
      @employer ||= total - employee
    end

    # @param [CPFContribution] other
    # @return [TrueClass, FalseClass]
    def ==(other)
      total == other.total && employee == other.employee
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
singapore_cpf_calculator-1.2.0 lib/singapore_cpf_calculator/cpf_contribution.rb
singapore_cpf_calculator-1.1.1 lib/singapore_cpf_calculator/cpf_contribution.rb