Class: DailyDonationReport::Row

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order) ⇒ Row

Returns a new instance of Row.



34
35
36
37
38
39
# File 'app/models/daily_donation_report.rb', line 34

def initialize(order)
  @id = order.id
  @total = DailyDonationReport.number_to_currency(order.donations.sum(&:total_price).to_f/100)
  @person = order.person
  @person_id = order.person.id
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



33
34
35
# File 'app/models/daily_donation_report.rb', line 33

def id
  @id
end

#personObject

Returns the value of attribute person.



33
34
35
# File 'app/models/daily_donation_report.rb', line 33

def person
  @person
end

#person_idObject

Returns the value of attribute person_id.



33
34
35
# File 'app/models/daily_donation_report.rb', line 33

def person_id
  @person_id
end

#totalObject

Returns the value of attribute total.



33
34
35
# File 'app/models/daily_donation_report.rb', line 33

def total
  @total
end

Instance Method Details

#to_aObject



41
42
43
# File 'app/models/daily_donation_report.rb', line 41

def to_a
  [id, total, person]
end