Class: Owemegod::Group
- Inherits:
-
Object
- Object
- Owemegod::Group
- Defined in:
- lib/owemegod/group.rb
Instance Attribute Summary collapse
-
#people ⇒ Object
Returns the value of attribute people.
Instance Method Summary collapse
- #add_person(person) ⇒ Object
- #distribute ⇒ Object
-
#initialize(people = []) ⇒ Group
constructor
Initializes an event with a certain array of people.
Constructor Details
#initialize(people = []) ⇒ Group
Initializes an event with a certain array of people
9 10 11 12 13 14 |
# File 'lib/owemegod/group.rb', line 9 def initialize(people = []) @people ||= [] people.each do |person| add_person person end end |
Instance Attribute Details
#people ⇒ Object
Returns the value of attribute people.
6 7 8 |
# File 'lib/owemegod/group.rb', line 6 def people @people end |
Instance Method Details
#add_person(person) ⇒ Object
16 17 18 |
# File 'lib/owemegod/group.rb', line 16 def add_person(person) people << person end |
#distribute ⇒ Object
20 21 22 23 24 |
# File 'lib/owemegod/group.rb', line 20 def distribute distribution = DebtDistribution.new(people) distribution.calculate distribution end |