Class: SimpleInvoice::LineItems
- Inherits:
-
Object
- Object
- SimpleInvoice::LineItems
- Defined in:
- lib/simple_invoice/line_items.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(line_items = []) ⇒ LineItems
constructor
A new instance of LineItems.
- #length ⇒ Object
- #push(line_item) ⇒ Object
- #to_a ⇒ Object
- #total ⇒ Fixnum
Constructor Details
#initialize(line_items = []) ⇒ LineItems
Returns a new instance of LineItems.
5 6 7 |
# File 'lib/simple_invoice/line_items.rb', line 5 def initialize line_items=[] @line_items = line_items end |
Instance Method Details
#each(&block) ⇒ Object
18 19 20 |
# File 'lib/simple_invoice/line_items.rb', line 18 def each &block @line_items.each(&block) end |
#length ⇒ Object
14 15 16 |
# File 'lib/simple_invoice/line_items.rb', line 14 def length @line_items.length end |
#push(line_item) ⇒ Object
10 11 12 |
# File 'lib/simple_invoice/line_items.rb', line 10 def push line_item @line_items.push line_item end |
#to_a ⇒ Object
22 23 24 |
# File 'lib/simple_invoice/line_items.rb', line 22 def to_a @line_items end |
#total ⇒ Fixnum
27 28 29 |
# File 'lib/simple_invoice/line_items.rb', line 27 def total sum @line_items.collect(&:total) end |