Class: SectionSummary
- Inherits:
-
Object
- Object
- SectionSummary
- Defined in:
- app/models/section_summary.rb
Instance Attribute Summary collapse
-
#available ⇒ Object
Returns the value of attribute available.
-
#comped ⇒ Object
Returns the value of attribute comped.
-
#sold ⇒ Object
Returns the value of attribute sold.
-
#total ⇒ Object
Returns the value of attribute total.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#available ⇒ Object
Returns the value of attribute available.
2 3 4 |
# File 'app/models/section_summary.rb', line 2 def available @available end |
#comped ⇒ Object
Returns the value of attribute comped.
2 3 4 |
# File 'app/models/section_summary.rb', line 2 def comped @comped end |
#sold ⇒ Object
Returns the value of attribute sold.
2 3 4 |
# File 'app/models/section_summary.rb', line 2 def sold @sold end |
#total ⇒ Object
Returns the value of attribute total.
2 3 4 |
# File 'app/models/section_summary.rb', line 2 def total @total end |
Class Method Details
.for_tickets(tickets = []) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'app/models/section_summary.rb', line 4 def self.for_tickets(tickets = []) summary = SectionSummary.new summary.total = tickets.size summary.sold = tickets.select{|t| t.sold?}.size summary.comped = tickets.select{|t| t.comped?}.size summary.available = tickets.select{|t| t.on_sale?}.size summary end |
Instance Method Details
#off_sale ⇒ Object
13 14 15 |
# File 'app/models/section_summary.rb', line 13 def off_sale total - available - sold - comped end |