Class: Metior::Actor Abstract
- Includes:
- AutoIncludeVCS
- Defined in:
- lib/metior/actor.rb
Overview
It has to be subclassed to implement a actor representation for a specific VCS.
Represents an actor in a source code repository
Depending on the repository's VCS this may be for example an author or committer.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#authored_commits ⇒ CommitCollection
(also: #commits)
readonly
The list of commits this actor has contributed to the source code repository.
-
#committed_commits ⇒ CommitCollection
readonly
The list of commits this actor has committed to the source code repository.
-
#id ⇒ String
readonly
A unqiue identifier for the actor.
-
#name ⇒ String
readonly
The full name of the actor.
Class Method Summary collapse
-
.id_for(actor) ⇒ String
abstract
Extracts a unique identifier from the given, VCS dependent actor object.
Instance Method Summary collapse
-
#additions ⇒ Fixnum
Returns the lines of code that have been added by this actor.
-
#deletions ⇒ Fixnum
Returns the lines of code that have been deleted by this actor.
-
#initialize(repo) ⇒ Actor
constructor
Creates a new actor linked to the given source code repository.
-
#inspect ⇒ String
Creates a string representation for this actor without recursing into commit and repository details.
-
#modifications ⇒ Fixnum
Returns the total of changed lines in all commits of this actor.
Methods included from AutoIncludeVCS
Constructor Details
#initialize(repo) ⇒ Actor
Creates a new actor linked to the given source code repository
50 51 52 53 54 |
# File 'lib/metior/actor.rb', line 50 def initialize(repo) @authored_commits = CommitCollection.new @committed_commits = CommitCollection.new @repo = repo end |
Instance Attribute Details
#authored_commits ⇒ CommitCollection (readonly) Also known as: commits
Returns The list of commits this actor has contributed to the source code repository.
24 25 26 |
# File 'lib/metior/actor.rb', line 24 def @authored_commits end |
#committed_commits ⇒ CommitCollection (readonly)
Returns The list of commits this actor has committed to the source code repository.
29 30 31 |
# File 'lib/metior/actor.rb', line 29 def committed_commits @committed_commits end |
#id ⇒ String (readonly)
Returns A unqiue identifier for the actor.
35 36 37 |
# File 'lib/metior/actor.rb', line 35 def id @id end |
#name ⇒ String (readonly)
Returns The full name of the actor.
32 33 34 |
# File 'lib/metior/actor.rb', line 32 def name @name end |
Class Method Details
.id_for(actor) ⇒ String
Different VCSs use different identifiers for users, so this method must be implemented for each supported VCS.
Extracts a unique identifier from the given, VCS dependent actor object
43 44 45 |
# File 'lib/metior/actor.rb', line 43 def self.id_for(actor) raise NotImplementedError end |
Instance Method Details
#additions ⇒ Fixnum
Returns the lines of code that have been added by this actor
59 60 61 |
# File 'lib/metior/actor.rb', line 59 def additions @authored_commits.additions end |
#deletions ⇒ Fixnum
Returns the lines of code that have been deleted by this actor
66 67 68 |
# File 'lib/metior/actor.rb', line 66 def deletions @authored_commits.deletions end |
#inspect ⇒ String
Creates a string representation for this actor without recursing into commit and repository details
74 75 76 77 78 79 80 |
# File 'lib/metior/actor.rb', line 74 def inspect '#<%s:0x%x: @commits=%d @id="%s" @name="%s" @repo="%s"' % [ self.class.name, __id__ * 2, @authored_commits.size, @id, @name, @repo.path ] end |
#modifications ⇒ Fixnum
Returns the total of changed lines in all commits of this actor
85 86 87 |
# File 'lib/metior/actor.rb', line 85 def modifications @authored_commits.modifications end |