Class: GitDiff::StatsCalculator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collector) ⇒ StatsCalculator

Returns a new instance of StatsCalculator.



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

def initialize(collector)
  @collector = collector
end

Instance Attribute Details

#collectorObject (readonly)

Returns the value of attribute collector.



5
6
7
# File 'lib/git_diff/stats_calculator.rb', line 5

def collector
  @collector
end

Instance Method Details

#totalObject



11
12
13
14
15
16
17
# File 'lib/git_diff/stats_calculator.rb', line 11

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