Class: GitDiff::Hunk

Inherits:
Object
  • Object
show all
Defined in:
lib/git_diff/hunk.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range_info) ⇒ Hunk

Returns a new instance of Hunk.



9
10
11
12
# File 'lib/git_diff/hunk.rb', line 9

def initialize(range_info)
  @range_info = range_info
  @lines = []
end

Instance Attribute Details

#linesObject (readonly)

Returns the value of attribute lines.



7
8
9
# File 'lib/git_diff/hunk.rb', line 7

def lines
  @lines
end

#range_infoObject (readonly)

Returns the value of attribute range_info.



7
8
9
# File 'lib/git_diff/hunk.rb', line 7

def range_info
  @range_info
end

Instance Method Details

#<<(string) ⇒ Object



14
15
16
17
18
19
# File 'lib/git_diff/hunk.rb', line 14

def <<(string)
  Line.from_string(string).tap do |line|
    line_number_calculation.increment(line)
    lines << line
  end
end

#statsObject



21
22
23
# File 'lib/git_diff/hunk.rb', line 21

def stats
  @stats ||= Stats.total(collector)
end