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.



36
37
38
39
40
41
42
# File 'app/models/daily_donation_report.rb', line 36

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

Instance Attribute Details

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#orderObject

Returns the value of attribute order.



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

def order
  @order
end

#personObject

Returns the value of attribute person.



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

def person
  @person
end

#person_idObject

Returns the value of attribute person_id.



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

def person_id
  @person_id
end

#totalObject

Returns the value of attribute total.



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

def total
  @total
end

Instance Method Details

#to_aObject



44
45
46
# File 'app/models/daily_donation_report.rb', line 44

def to_a
  [id, total, person]
end