Class: DailyPassReport::Row
- Inherits:
-
Object
- Object
- DailyPassReport::Row
- Defined in:
- app/models/daily_pass_report.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
Returns the value of attribute details.
-
#id ⇒ Object
Returns the value of attribute id.
-
#order ⇒ Object
Returns the value of attribute order.
-
#pass_type ⇒ Object
Returns the value of attribute pass_type.
-
#person ⇒ Object
Returns the value of attribute person.
-
#person_id ⇒ Object
Returns the value of attribute person_id.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#total ⇒ Object
Returns the value of attribute total.
Instance Method Summary collapse
- #calculate_total ⇒ Object
-
#initialize(items) ⇒ Row
constructor
A new instance of Row.
Constructor Details
#initialize(items) ⇒ Row
Returns a new instance of Row.
34 35 36 37 38 39 40 41 42 |
# File 'app/models/daily_pass_report.rb', line 34 def initialize(items) @order = items.first.order @id = items.first.order.id @pass_type = items.first.product.pass_type.name @quantity = items.length @total = DailyPassReport.number_to_currency(items.sum(&:price).to_f/100) @person = items.first.order.person @person_id = items.first.order.person.id end |
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def details @details end |
#id ⇒ Object
Returns the value of attribute id.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def id @id end |
#order ⇒ Object
Returns the value of attribute order.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def order @order end |
#pass_type ⇒ Object
Returns the value of attribute pass_type.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def pass_type @pass_type end |
#person ⇒ Object
Returns the value of attribute person.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def person @person end |
#person_id ⇒ Object
Returns the value of attribute person_id.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def person_id @person_id end |
#quantity ⇒ Object
Returns the value of attribute quantity.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def quantity @quantity end |
#total ⇒ Object
Returns the value of attribute total.
33 34 35 |
# File 'app/models/daily_pass_report.rb', line 33 def total @total end |
Instance Method Details
#calculate_total ⇒ Object
44 45 46 |
# File 'app/models/daily_pass_report.rb', line 44 def calculate_total DailyPassReport.number_to_currency(@order.passes.sum(&:price).to_f/100) end |