Bracketed Tax Engine
git clone https://framagit.org/anotherdev/taxes.git
cd taxes
./bin/setup
bundle exec rake install
A sample brackets.json
and incomes.txt
file are provided as part of the
repository.
./exe/taxes -b samples/brackets.json -i samples/incomes.txt -o taxes.txt
Note: the gem contains a taxes
executable. Depending on your local setup, it
should now be available as part of your $PATH
environment variable.
bundle exec rake # run reek, rubocop and rspec
open coverage/index.html # see the code coverage
Right now, the Taxes::Engines
assumes that it's dealing with US Dollars,
hence the rounding is done using round(2)
in the Taxes::Engine
class. A
better approach would be to leverage an existing gem such as
Money to ensure the rounding follows the
currency rules.