Solution to the sales tax problem in ruby