Class: Fastlane::Helper::GitlabDiffFile

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/gitlab_increate_line_notes/helper/gitlab_diff_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(oth, nth, diff) ⇒ GitlabDiffFile

Returns a new instance of GitlabDiffFile.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fastlane/plugin/gitlab_increate_line_notes/helper/gitlab_diff_file.rb', line 20

def initialize(oth, nth, diff)
  @old_path = oth
  @new_path = nth

  patch = GitDiffParser::Patch.new(diff)
  return unless patch

  @lines = patch.changed_lines.map do |git_diff_line|
    # #<GitDiffParser::Line:0x00007fd3cdb40ca0
    #   @content="+\n",
    #   @number=66,
    #   @patch_position=5>
    GitlabDiffLine.new(git_diff_line.content, git_diff_line.number, git_diff_line.patch_position)
  end

  @line_numbers = @lines.map(&:line)
end

Instance Attribute Details

#line_numbersObject

Returns the value of attribute line_numbers.



18
19
20
# File 'lib/fastlane/plugin/gitlab_increate_line_notes/helper/gitlab_diff_file.rb', line 18

def line_numbers
  @line_numbers
end

#linesObject

Returns the value of attribute lines.



18
19
20
# File 'lib/fastlane/plugin/gitlab_increate_line_notes/helper/gitlab_diff_file.rb', line 18

def lines
  @lines
end

#new_pathObject

Returns the value of attribute new_path.



18
19
20
# File 'lib/fastlane/plugin/gitlab_increate_line_notes/helper/gitlab_diff_file.rb', line 18

def new_path
  @new_path
end

#old_pathObject

Returns the value of attribute old_path.



18
19
20
# File 'lib/fastlane/plugin/gitlab_increate_line_notes/helper/gitlab_diff_file.rb', line 18

def old_path
  @old_path
end