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



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



20
21
22
23
24
25
26
# File 'lib/codespicuous/committer.rb', line 20

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



65
66
67
68
69
70
71
# File 'lib/codespicuous/committer.rb', line 65

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



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

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

#amount_of_commitsObject



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

def amount_of_commits
  @commits.amount
end

#amount_of_commits_in_week(week_start) ⇒ Object



49
50
51
# File 'lib/codespicuous/committer.rb', line 49

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

#amount_of_commits_to_repository(name) ⇒ Object



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

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



53
54
55
# File 'lib/codespicuous/committer.rb', line 53

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



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

def amount_of_weeks_committed_to_repository name
  @commits.amount_of_weeks_committed_in_repository(name)
end

#clone_without_commitsObject



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

def clone_without_commits
  cloned_committer = Committer.new(username)
  cloned_committer.first_name = first_name
  cloned_committer.last_name = last_name
  cloned_committer.email = email
  cloned_committer
end

#committed_repositoriesObject



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

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

#in_team_with_name?(team_name) ⇒ Boolean



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

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