Class: Taxedo::Builder::Hash
- Inherits:
-
Base
- Object
- Base
- Taxedo::Builder::Hash
show all
- Defined in:
- lib/taxedo/builder/hash.rb
Direct Known Subclasses
Json
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #price, #subtotal, #t, #taxes, #total
Instance Method Details
#generate ⇒ Object
2
3
4
|
# File 'lib/taxedo/builder/hash.rb', line 2
def generate
{ subtotal: subtotal, taxes: generate_taxes, total: total }
end
|
#generate_tax(tax) ⇒ Object
10
11
12
|
# File 'lib/taxedo/builder/hash.rb', line 10
def generate_tax(tax)
{ id: tax.id, name: tax.name, amount: tax.amount }
end
|
#generate_taxes ⇒ Object
6
7
8
|
# File 'lib/taxedo/builder/hash.rb', line 6
def generate_taxes
taxes.map{ |t| generate_tax t }
end
|