module TaxManipulator

Constants

VERSION

Public Class Methods

config() click to toggle source
# File lib/tax_manipulator.rb, line 12
def self.config
  @config ||= Configuration.new
end
configure() { |config| ... } click to toggle source
# File lib/tax_manipulator.rb, line 16
def self.configure
  yield(config)
end
for(price, scheme: nil, date: Date.today) click to toggle source
# File lib/tax_manipulator.rb, line 20
def self.for(price, scheme: nil, date: Date.today)
  scheme ||= config.default_scheme

  case scheme
  when :excl_tax
    Manipulator::ExcludingTax.new(price, date)
  when :incl_tax
    Manipulator::IncludingTax.new(price, date)
  else
    raise UnknownStrategyError
  end
end
reset_config!() click to toggle source
# File lib/tax_manipulator.rb, line 33
def self.reset_config!
  @config = Configuration.new
end