Class: Gitlab::Git::Blame

Inherits:
Object
  • Object
show all
Includes:
EncodingHelper
Defined in:
lib/gitlab_git/blame.rb

Constant Summary

Constants included from EncodingHelper

EncodingHelper::ENCODING_CONFIDENCE_THRESHOLD

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EncodingHelper

#encode!, #encode_utf8

Constructor Details

#initialize(repository, sha, path) ⇒ Blame

Returns a new instance of Blame.



10
11
12
13
14
15
16
# File 'lib/gitlab_git/blame.rb', line 10

def initialize(repository, sha, path)
  @repo = repository
  @sha = sha
  @path = path
  @lines = []
  @blames = load_blame
end

Instance Attribute Details

#blamesObject (readonly)

Returns the value of attribute blames.



8
9
10
# File 'lib/gitlab_git/blame.rb', line 8

def blames
  @blames
end

#linesObject (readonly)

Returns the value of attribute lines.



8
9
10
# File 'lib/gitlab_git/blame.rb', line 8

def lines
  @lines
end

Instance Method Details

#eachObject



18
19
20
21
22
23
24
25
# File 'lib/gitlab_git/blame.rb', line 18

def each
  @blames.each do |blame|
    yield(
      Gitlab::Git::Commit.new(blame.commit),
      blame.line
    )
  end
end