Class: DailyTicketReport::Row
- Inherits:
-
Object
- Object
- DailyTicketReport::Row
- Defined in:
- app/models/daily_ticket_report.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#order ⇒ Object
Returns the value of attribute order.
-
#person ⇒ Object
Returns the value of attribute person.
-
#person_id ⇒ Object
Returns the value of attribute person_id.
-
#special_instructions ⇒ Object
Returns the value of attribute special_instructions.
-
#ticket_details ⇒ Object
Returns the value of attribute ticket_details.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
- #calculate_total ⇒ Object
- #create_ticket_details ⇒ Object
-
#initialize(order) ⇒ Row
constructor
A new instance of Row.
- #to_a ⇒ Object
Constructor Details
#initialize(order) ⇒ Row
Returns a new instance of Row.
41 42 43 44 45 46 47 48 49 |
# File 'app/models/daily_ticket_report.rb', line 41 def initialize(order) @order = order @id = order.id @ticket_details = create_ticket_details @total = calculate_total @person = order.person @person_id = order.person.id @special_instructions = order.special_instructions end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
40 41 42 |
# File 'app/models/daily_ticket_report.rb', line 40 def id @id end |
#order ⇒ Object
Returns the value of attribute order.
40 41 42 |
# File 'app/models/daily_ticket_report.rb', line 40 def order @order end |
#person ⇒ Object
Returns the value of attribute person.
40 41 42 |
# File 'app/models/daily_ticket_report.rb', line 40 def person @person end |
#person_id ⇒ Object
Returns the value of attribute person_id.
40 41 42 |
# File 'app/models/daily_ticket_report.rb', line 40 def person_id @person_id end |
#special_instructions ⇒ Object
Returns the value of attribute special_instructions.
40 41 42 |
# File 'app/models/daily_ticket_report.rb', line 40 def special_instructions @special_instructions end |
#ticket_details ⇒ Object
Returns the value of attribute ticket_details.
40 41 42 |
# File 'app/models/daily_ticket_report.rb', line 40 def ticket_details @ticket_details end |
#total ⇒ Object
Returns the value of attribute total.
40 41 42 |
# File 'app/models/daily_ticket_report.rb', line 40 def total @total end |
Instance Method Details
#calculate_total ⇒ Object
55 56 57 |
# File 'app/models/daily_ticket_report.rb', line 55 def calculate_total DailyTicketReport.number_to_currency(@order.tickets.reject(&:exchanged?).sum(&:price).to_f/100) end |
#create_ticket_details ⇒ Object
51 52 53 |
# File 'app/models/daily_ticket_report.rb', line 51 def create_ticket_details @order.ticket_details end |
#to_a ⇒ Object
59 60 61 |
# File 'app/models/daily_ticket_report.rb', line 59 def to_a [id, total, person, ticket_details, special_instructions] end |