Class: Gitlab::Git::Blame
- Inherits:
-
Object
- Object
- Gitlab::Git::Blame
- Includes:
- EncodingHelper
- Defined in:
- lib/gitlab/git/blame.rb
Constant Summary
Constants included from EncodingHelper
EncodingHelper::BOM_UTF8, EncodingHelper::ENCODING_CONFIDENCE_THRESHOLD, EncodingHelper::ESCAPED_CHARS, EncodingHelper::UNICODE_REPLACEMENT_CHARACTER
Instance Attribute Summary collapse
-
#blames ⇒ Object
readonly
Returns the value of attribute blames.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#range ⇒ Object
readonly
Returns the value of attribute range.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(repository, sha, path, range: nil) ⇒ Blame
constructor
A new instance of Blame.
Methods included from EncodingHelper
#binary_io, #detect_binary?, #detect_encoding, #detect_libgit2_binary?, #encode!, #encode_binary, #encode_utf8, #encode_utf8_no_detect, #encode_utf8_with_escaping!, #encode_utf8_with_replacement_character, #strip_bom, #unquote_path
Constructor Details
#initialize(repository, sha, path, range: nil) ⇒ Blame
Returns a new instance of Blame.
10 11 12 13 14 15 16 17 |
# File 'lib/gitlab/git/blame.rb', line 10 def initialize(repository, sha, path, range: nil) @repo = repository @sha = sha @path = path @range = range @lines = [] @blames = load_blame end |
Instance Attribute Details
#blames ⇒ Object (readonly)
Returns the value of attribute blames.
8 9 10 |
# File 'lib/gitlab/git/blame.rb', line 8 def blames @blames end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
8 9 10 |
# File 'lib/gitlab/git/blame.rb', line 8 def lines @lines end |
#range ⇒ Object (readonly)
Returns the value of attribute range.
8 9 10 |
# File 'lib/gitlab/git/blame.rb', line 8 def range @range end |
Instance Method Details
#each ⇒ Object
19 20 21 22 23 |
# File 'lib/gitlab/git/blame.rb', line 19 def each @blames.each do |blame| yield(blame.commit, blame.line, blame.previous_path, blame.span) end end |