Sha256: bec802a28ea72be306f15ac3b8170e3a553ee6f15da030210bc20175ab8d1fef

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module SingaporeCharitableDonations
  module Calculators

    # Collection of calculators for Singapore charitable donations.
    class << self

      # @param [Date] date Date of contribution
      # @param [String] type The type of contribution fund. Can be CDAC, ECF, MBMF, SINDA
      # @return [#calculator] The calculator depending on the type and date.
      def get(date:, type:)
        calculators.find { |calculator| calculator.applies_to?(date, type) }
      end

      private

      def calculators
        [
          CDAC::Year2014Calculator,
          CDAC::Year2015Calculator,
          ECF::Year2014Calculator,
          ECF::Year2015Calculator,
          MBMF::Year2009Calculator,
          MBMF::Year2016Calculator,
          SINDA::Year2014Calculator,
          SINDA::Year2015Calculator,
        ]
      end

    end

  end
end

require_relative 'calculators/cdac/year_2014_calculator'
require_relative 'calculators/cdac/year_2015_calculator'
require_relative 'calculators/ecf/year_2014_calculator'
require_relative 'calculators/ecf/year_2015_calculator'
require_relative 'calculators/mbmf/year_2009_calculator'
require_relative 'calculators/mbmf/year_2016_calculator'
require_relative 'calculators/sinda/year_2014_calculator'
require_relative 'calculators/sinda/year_2015_calculator'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
singapore_charitable_donations-1.0.3 lib/singapore_charitable_donations/calculators.rb