Sha256: bd347534fab45e07feb833cc3d885dd41fd0290dea6427ef87b3723028759272

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module SingaporeCharitableDonations
  module Calculators
    module CDAC

      # Chinese Development Assistance Council (CDAC) Fund contribution calculator for year 2015 onwards.
      module Year2015Calculator
        class << self

          # @param [BigDecimal] total_wage
          # @return [BigDecimal] contribution amount
          def calculate(total_wage)
            case
            when total_wage <= 2_000.00
              BigDecimal "0.50"
            when total_wage <= 3_500.00
              BigDecimal "1.00"
            when total_wage <= 5_000.00
              BigDecimal "1.50"
            when total_wage <= 7_500.00
              BigDecimal "2.00"
            when total_wage > 7_500.00
              BigDecimal "3.00"
            end
          end

          # @param [Date] date to be considered for calculation
          # @param [String] type of charitable contribution
          # @return [TrueClass, FalseClass]
          def applies_to?(date, type)
            date.year >= 2015 && type == 'CDAC'
          end

        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
singapore_charitable_donations-1.0.3 lib/singapore_charitable_donations/calculators/cdac/year_2015_calculator.rb
singapore_charitable_donations-1.0.1 lib/singapore_charitable_donations/calculators/cdac/year_2015_calculator.rb
singapore_charitable_donations-1.0.0 lib/singapore_charitable_donations/calculators/cdac/year_2015_calculator.rb
singapore_charitable_donations-0.0.1 lib/singapore_charitable_donations/calculators/cdac/year_2015_calculator.rb