Class: TicketSummary

Inherits:
Object
  • Object
show all
Defined in:
app/models/ticket_summary.rb

Defined Under Namespace

Classes: Row

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTicketSummary

Returns a new instance of TicketSummary.



4
5
6
# File 'app/models/ticket_summary.rb', line 4

def initialize
  @rows = []
end

Instance Attribute Details

#rowsObject

Returns the value of attribute rows.



2
3
4
# File 'app/models/ticket_summary.rb', line 2

def rows
  @rows
end

Instance Method Details

#<<(ticket) ⇒ Object



12
13
14
# File 'app/models/ticket_summary.rb', line 12

def <<(ticket)
  row_for_this(ticket.show) << ticket
end

#row_for_this(show) ⇒ Object



8
9
10
# File 'app/models/ticket_summary.rb', line 8

def row_for_this(show)
  @rows.find {|row| row.show == show} || (@rows << TicketSummary::Row.new).last
end