Class: Owemegod::Group

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#peopleObject

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

#distributeObject



20
21
22
23
24
# File 'lib/owemegod/group.rb', line 20

def distribute
  distribution = DebtDistribution.new(people)
  distribution.calculate
  distribution
end