Class: Vivlio::Starter::CLI::TotalsCalculator::TotalsAggregator
- Inherits:
-
Object
- Object
- Vivlio::Starter::CLI::TotalsCalculator::TotalsAggregator
- Defined in:
- lib/vivlio/starter/cli/metrics.rb
Overview
集計処理本体
Constant Summary collapse
- COUNT_KEYS =
%w[lines chars chars_without_newline sentences commas clauses].freeze
Instance Method Summary collapse
-
#initialize(stats) ⇒ TotalsAggregator
constructor
A new instance of TotalsAggregator.
- #result ⇒ Object
Constructor Details
#initialize(stats) ⇒ TotalsAggregator
Returns a new instance of TotalsAggregator.
256 257 258 259 |
# File 'lib/vivlio/starter/cli/metrics.rb', line 256 def initialize(stats) @stats = stats @totals = initial_totals end |
Instance Method Details
#result ⇒ Object
261 262 263 264 265 |
# File 'lib/vivlio/starter/cli/metrics.rb', line 261 def result stats.each { |stat| accumulate(stat) } finalize_averages totals end |