Class: Committer

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ Committer

Returns a new instance of Committer.



7
8
9
10
# File 'lib/codespicuous/committer.rb', line 7

def initialize(username)
  @username = username
  @commits = Commits.new
end

Instance Attribute Details

#commitsObject (readonly)

Returns the value of attribute commits.



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

def commits
  @commits
end

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/codespicuous/committer.rb', line 5

def email
  @email
end

#first_nameObject

Returns the value of attribute first_name.



5
6
7
# File 'lib/codespicuous/committer.rb', line 5

def first_name
  @first_name
end

#last_nameObject

Returns the value of attribute last_name.



5
6
7
# File 'lib/codespicuous/committer.rb', line 5

def last_name
  @last_name
end

#teamObject

Returns the value of attribute team.



5
6
7
# File 'lib/codespicuous/committer.rb', line 5

def team
  @team
end

#usernameObject

Returns the value of attribute username.



5
6
7
# File 'lib/codespicuous/committer.rb', line 5

def username
  @username
end

Class Method Details

.create_committer(login, firstname, lastname, email) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/codespicuous/committer.rb', line 12

def self.create_committer(, firstname, lastname, email)
  committer = Committer.new()
  committer.first_name = firstname
  committer.last_name = lastname
  committer.email = email
  committer
end

Instance Method Details

#==(committer) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/codespicuous/committer.rb', line 57

def ==(committer)
  username == committer.username &&
  first_name == committer.first_name &&
  last_name == committer.last_name &&
  email == committer.email &&
  team.name == committer.team.name
end

#add_commit(commit) ⇒ Object



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

def add_commit commit
  @commits.add(commit)
  commit.committer = self
end

#amount_of_commitsObject



29
30
31
# File 'lib/codespicuous/committer.rb', line 29

def amount_of_commits
  @commits.amount
end

#amount_of_commits_in_week(week_start) ⇒ Object



41
42
43
# File 'lib/codespicuous/committer.rb', line 41

def amount_of_commits_in_week(week_start)
  @commits.amount_of_commits_in_week(week_start)
end

#amount_of_commits_to_repository(name) ⇒ Object



33
34
35
# File 'lib/codespicuous/committer.rb', line 33

def amount_of_commits_to_repository name
  @commits.amount_of_commits_to_repository name
end

#amount_of_commits_to_repository_in_week(name, week_start) ⇒ Object



45
46
47
# File 'lib/codespicuous/committer.rb', line 45

def amount_of_commits_to_repository_in_week(name, week_start)
  @commits.amount_of_commits_to_repository_in_week(name, week_start)
end

#amount_of_weeks_committed_to_repository(name) ⇒ Object



37
38
39
# File 'lib/codespicuous/committer.rb', line 37

def amount_of_weeks_committed_to_repository name
  @commits.amount_of_weeks_committed_in_repository(name)
end

#committed_repositoriesObject



49
50
51
52
53
54
55
# File 'lib/codespicuous/committer.rb', line 49

def committed_repositories
  repositories = []
  commits.each do |commit|
    repositories.push(commit.repository)
  end
  repositories.uniq
end

#in_team_with_name?(team_name) ⇒ Boolean

Returns:

  • (Boolean)


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

def in_team_with_name?(team_name)
  @team.name == team_name
end