Sha256: 5e482fca5bd4a3cdbc9c50968049092caac1a4092527719ab6722b727f5311b3

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 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_wage
          # @return [BigDecimal] contribution amount
          def calculate(total_wages)
            rounded_total_wages = total_wages.round
            case
            when rounded_total_wages <= 200.00
              BigDecimal "0.00"
            when rounded_total_wages <= 1_000.00
              BigDecimal "2.00"
            when rounded_total_wages <= 2_000.00
              BigDecimal "3.50"
            when rounded_total_wages <= 3_000.00
              BigDecimal "5.00"
            when rounded_total_wages <= 4_000.00
              BigDecimal "12.50"
            else # total_wages > 4_000.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

2 entries across 2 versions & 1 rubygems

Version Path
singapore_charitable_donations-1.0.0 lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb
singapore_charitable_donations-0.0.1 lib/singapore_charitable_donations/calculators/mbmf/year_2009_calculator.rb