Class: Owemegod::Person

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/owemegod/person.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Person

Returns a new instance of Person.



8
9
10
11
# File 'lib/owemegod/person.rb', line 8

def initialize(*args)
  super
  self.expenses = ExpenseCollection.new
end

Instance Attribute Details

#expensesObject

Returns the value of attribute expenses.



6
7
8
# File 'lib/owemegod/person.rb', line 6

def expenses
  @expenses
end

Instance Method Details

#add_expense(name, amount) ⇒ Object



17
18
19
# File 'lib/owemegod/person.rb', line 17

def add_expense(name, amount)
  expenses.add_expense(name, amount)
end

#total_expensesObject



21
22
23
# File 'lib/owemegod/person.rb', line 21

def total_expenses
  expenses.value
end