Class: Commit
- Inherits:
-
Object
- Object
- Commit
- Defined in:
- lib/codespicuous/commits.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#changes ⇒ Object
Returns the value of attribute changes.
-
#committer ⇒ Object
Returns the value of attribute committer.
-
#date ⇒ Object
Returns the value of attribute date.
-
#message ⇒ Object
Returns the value of attribute message.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#revision ⇒ Object
Returns the value of attribute revision.
Instance Method Summary collapse
- #==(commit) ⇒ Object
- #by_team_with_name?(team_name) ⇒ Boolean
- #in_week?(date) ⇒ Boolean
-
#initialize ⇒ Commit
constructor
A new instance of Commit.
- #inspect ⇒ Object
- #my_object_id ⇒ Object
Constructor Details
#initialize ⇒ Commit
Returns a new instance of Commit.
26 27 28 |
# File 'lib/codespicuous/commits.rb', line 26 def initialize @changes = [] end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
30 31 32 |
# File 'lib/codespicuous/commits.rb', line 30 def @author end |
#changes ⇒ Object
Returns the value of attribute changes.
30 31 32 |
# File 'lib/codespicuous/commits.rb', line 30 def changes @changes end |
#committer ⇒ Object
Returns the value of attribute committer.
30 31 32 |
# File 'lib/codespicuous/commits.rb', line 30 def committer @committer end |
#date ⇒ Object
Returns the value of attribute date.
30 31 32 |
# File 'lib/codespicuous/commits.rb', line 30 def date @date end |
#message ⇒ Object
Returns the value of attribute message.
30 31 32 |
# File 'lib/codespicuous/commits.rb', line 30 def @message end |
#repository ⇒ Object
Returns the value of attribute repository.
30 31 32 |
# File 'lib/codespicuous/commits.rb', line 30 def repository @repository end |
#revision ⇒ Object
Returns the value of attribute revision.
30 31 32 |
# File 'lib/codespicuous/commits.rb', line 30 def revision @revision end |
Instance Method Details
#==(commit) ⇒ Object
48 49 50 51 52 53 |
# File 'lib/codespicuous/commits.rb', line 48 def ==(commit) is_equal = @repository == commit.repository && @revision == commit.revision raise CommitSameButDifferentError.new if is_equal && @author != commit. is_equal end |
#by_team_with_name?(team_name) ⇒ Boolean
32 33 34 |
# File 'lib/codespicuous/commits.rb', line 32 def by_team_with_name?(team_name) committer.in_team_with_name?(team_name) end |
#in_week?(date) ⇒ Boolean
36 37 38 |
# File 'lib/codespicuous/commits.rb', line 36 def in_week?(date) @date.cwyear == date.cwyear && @date.cweek == date.cweek end |
#inspect ⇒ Object
44 45 46 |
# File 'lib/codespicuous/commits.rb', line 44 def inspect "Commit(o:#{my_object_id}) #{repository.name}:#{revision}" end |
#my_object_id ⇒ Object
40 41 42 |
# File 'lib/codespicuous/commits.rb', line 40 def my_object_id object_id end |