Class: Committer
- Inherits:
-
Object
- Object
- Committer
- Defined in:
- lib/codespicuous/committer.rb
Instance Attribute Summary collapse
-
#commits ⇒ Object
readonly
Returns the value of attribute commits.
-
#email ⇒ Object
Returns the value of attribute email.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#team ⇒ Object
Returns the value of attribute team.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #==(committer) ⇒ Object
- #add_commit(commit) ⇒ Object
- #amount_of_commits ⇒ Object
- #amount_of_commits_in_week(week_start) ⇒ Object
- #amount_of_commits_to_repository(name) ⇒ Object
- #amount_of_commits_to_repository_in_week(name, week_start) ⇒ Object
- #amount_of_weeks_committed_to_repository(name) ⇒ Object
- #clone_without_commits ⇒ Object
- #committed_repositories ⇒ Object
- #in_team_with_name?(team_name) ⇒ Boolean
-
#initialize(username) ⇒ Committer
constructor
A new instance of Committer.
Constructor Details
Instance Attribute Details
#commits ⇒ Object (readonly)
Returns the value of attribute commits.
4 5 6 |
# File 'lib/codespicuous/committer.rb', line 4 def commits @commits end |
#email ⇒ Object
Returns the value of attribute email.
5 6 7 |
# File 'lib/codespicuous/committer.rb', line 5 def email @email end |
#first_name ⇒ Object
Returns the value of attribute first_name.
5 6 7 |
# File 'lib/codespicuous/committer.rb', line 5 def first_name @first_name end |
#last_name ⇒ Object
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/codespicuous/committer.rb', line 5 def last_name @last_name end |
#team ⇒ Object
Returns the value of attribute team.
5 6 7 |
# File 'lib/codespicuous/committer.rb', line 5 def team @team end |
#username ⇒ Object
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(login, firstname, lastname, email) committer = Committer.new(login) 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_commits ⇒ Object
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_commits ⇒ Object
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_repositories ⇒ Object
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 |