module SingaporeSDLCalculator

Constants

VERSION

Public Class Methods

calculate(remuneration:) click to toggle source
# File lib/singapore_sdl_calculator.rb, line 8
def calculate(remuneration:)
  determine_contribution_for(remuneration)
end

Private Class Methods

bounded(rate) click to toggle source

For any value within the bounds it returns the original value. Otherwise returns the lower limit or upper limit depending on which limit is closer.

# File lib/singapore_sdl_calculator.rb, line 32
def bounded(rate)
  [[rate, maximum_levy_rate].min, minimum_levy_rate].max
end
determine_contribution_for(amount) click to toggle source
# File lib/singapore_sdl_calculator.rb, line 14
def determine_contribution_for(amount)
  bounded(amount * levy_rate)
end
levy_rate() click to toggle source
# File lib/singapore_sdl_calculator.rb, line 18
def levy_rate
  BigDecimal "0.0025"
end
maximum_levy_rate() click to toggle source
# File lib/singapore_sdl_calculator.rb, line 26
def maximum_levy_rate
  BigDecimal "11.25"
end
minimum_levy_rate() click to toggle source
# File lib/singapore_sdl_calculator.rb, line 22
def minimum_levy_rate
  BigDecimal "2.00"
end