Class: Metior::Adapter::Grit::Actor

Inherits:
Metior::Actor show all
Defined in:
lib/metior/adapter/grit/actor.rb

Overview

Represents an actor in a Git source code repository, i.e. an author or committer.

Author:

Instance Attribute Summary

Attributes inherited from Metior::Actor

#authored_commits, #committed_commits, #id, #name

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Metior::Actor

#additions, #deletions, #inspect, #modifications

Methods included from Metior::AutoIncludeAdapter

included

Constructor Details

- (Actor) initialize(repo, actor)

Creates a new actor instance

Parameters:

  • repo (Repository)

    The repository this actor belongs to

  • actor (Grit::Actor)

    The actor object from Grit



32
33
34
35
36
37
38
39
40
41
# File 'lib/metior/adapter/grit/actor.rb', line 32

def initialize(repo, actor)
  super repo
  @id   = actor.email
  @name = actor.name

  if @id.respond_to? :force_encoding
    @id.force_encoding 'utf-8'
    @name.force_encoding 'utf-8'
  end
end

Class Method Details

+ (String) id_for(actor)

Returns the email address as an identifier for the given actor.

Git uses email addresses as identifiers for its actors.

Parameters:

Returns:

  • (String)

    ??The email address of the given actor



24
25
26
# File 'lib/metior/adapter/grit/actor.rb', line 24

def self.id_for(actor)
  actor.email
end