BryanaKnight/sales_tax — pull request #2 by gschorkopf (2014-02-02 17:16:45+00:00)
Title: Refactors on Receipt

For line 27 (item_totals) and 11 (summary): There probably isn't a need to check if the sales_tax is 0 or not. If it is 0, there's no harm in adding it to the price, because it won't affect the price.

I might also argue for the inclusion of two new methods: "item_total" and "line_summary". You have this bit of logic essentially twice: sales_tax(item) + price(item). That seems like the definition of "item_total". "line_summary" would break up the name_and_price(line).split[0..-2].join(" ") and also have that item_total bit.

summary might then look as simple as:
```
def summary
input.map {|line| line_summary(line)}
end
```