Class: Attractor::RubyCalculator

Inherits:
BaseCalculator
  • Object
show all
Defined in:
lib/attractor/calculators/ruby_calculator.rb

Instance Method Summary collapse

Constructor Details

#initialize(file_prefix: '', ignores: '', minimum_churn_count: 3, start_ago: 365 * 5, verbose: false) ⇒ RubyCalculator

Returns a new instance of RubyCalculator.



7
8
9
10
# File 'lib/attractor/calculators/ruby_calculator.rb', line 7

def initialize(file_prefix: '', ignores: '', minimum_churn_count: 3, start_ago: 365 * 5, verbose: false)
  super(file_prefix: file_prefix, ignores: ignores, file_extension: 'rb', minimum_churn_count: minimum_churn_count, start_ago: start_ago, verbose: verbose)
  @type = "Ruby"
end

Instance Method Details

#calculateObject



12
13
14
15
16
17
18
19
20
# File 'lib/attractor/calculators/ruby_calculator.rb', line 12

def calculate
  super do |change|
    flogger = Flog.new(all: true)
    flogger.flog(change[:file_path])
    complexity = flogger.total_score
    details = flogger.totals
    [complexity, details]
  end
end