Class: Team

Inherits:
Object
  • Object
show all
Defined in:
lib/codespicuous/teams.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Team



6
7
8
9
# File 'lib/codespicuous/teams.rb', line 6

def initialize(name)
  @name = name
  @members = {}
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/codespicuous/teams.rb', line 4

def name
  @name
end

Instance Method Details

#<=>(other) ⇒ Object



38
39
40
# File 'lib/codespicuous/teams.rb', line 38

def <=> other
  @name <=> other.name
end

#==(team) ⇒ Object



42
43
44
# File 'lib/codespicuous/teams.rb', line 42

def ==(team)
  name == team.name && members == team.members
end

#add_member(member) ⇒ Object



11
12
13
14
# File 'lib/codespicuous/teams.rb', line 11

def add_member(member)
  @members[member.username] = member
  member.team = self
end

#add_members(members) ⇒ Object



16
17
18
# File 'lib/codespicuous/teams.rb', line 16

def add_members(members)
  members.each { |member| add_member(member) }
end

#amount_of_membersObject



30
31
32
# File 'lib/codespicuous/teams.rb', line 30

def amount_of_members
  @members.size
end

#committed_repositoriesObject



46
47
48
49
50
51
52
53
54
# File 'lib/codespicuous/teams.rb', line 46

def committed_repositories

  repositories = []

  each_member do |member|
    repositories += member.committed_repositories
  end
  repositories.uniq
end

#each_memberObject



24
25
26
27
28
# File 'lib/codespicuous/teams.rb', line 24

def each_member
  @members.values.each { |member|
    yield member
  }
end

#member_usernamesObject



34
35
36
# File 'lib/codespicuous/teams.rb', line 34

def member_usernames
  @members.keys
end

#membersObject



20
21
22
# File 'lib/codespicuous/teams.rb', line 20

def members
  @members.values
end