Sha256: f1eda2b9a987996ddbc7fc4bb14db98e69997830b814ba42c0ec38b54d5bc14d

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

module SingaporeCharitableDonations
  module Calculators
    module MBMF

      # Mosque Building and Mendaki Fund contribution calculator for the year 2009 onwards.
      module Year2009Calculator
        class << self

          # @param [BigDecimal] total_wages
          # @return [BigDecimal] contribution amount
          def calculate(total_wages)
            case
            when total_wages <= 200.00
              BigDecimal "0.00"
            when total_wages < 1_001.00
              BigDecimal "2.00"
            when total_wages < 2_001.00
              BigDecimal "3.50"
            when total_wages < 3_001.00
              BigDecimal "5.00"
            when total_wages < 4_001.00
              BigDecimal "12.50"
            else # total_wages >= 4_001.00
              BigDecimal "16.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 >= 2009 && type == 'MBMF'
          end

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
singapore_charitable_donations-1.0.1 lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb