class TaxUtil

Public Class Methods

calculate(gross_amount, calc_method={method: :default}) click to toggle source
# File lib/tax_util.rb, line 4
def self.calculate(gross_amount, calc_method={method: :default})
  self.const_get(classify(calc_method[:method])).new(gross_amount).calculate
end

Private Class Methods

classify(symbol_name) click to toggle source
# File lib/tax_util.rb, line 9
def self.classify(symbol_name)
  "CalcMethod::#{symbol_name.to_s.split('_').map{|name_part| (name_part[0] = name_part[0].upcase!) ; name_part }.join('')}"
end