Class: GitDiff::StatsCollector::Hunk

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hunk) ⇒ Hunk

Returns a new instance of Hunk.



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

def initialize(hunk)
  @hunk = hunk
end

Instance Attribute Details

#hunkObject (readonly)

Returns the value of attribute hunk.



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

def hunk
  @hunk
end

Instance Method Details

#collectObject



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

def collect
  GitDiff::Stats.new(
    number_of_lines: number_of_lines,
    number_of_additions: number_of_additions,
    number_of_deletions: number_of_deletions
  )
end