Sha256: 673ce1f8117e7da99aa4b5c9646ca30c7122fa5d4a6bd76c6bf67856c4e0f8c0

Contents?: true

Size: 549 Bytes

Versions: 1

Compression:

Stored size: 549 Bytes

Contents

# frozen_string_literal: true

require 'flog'

module Attractor
  class RubyCalculator < BaseCalculator
    def initialize(file_prefix: '', minimum_churn_count: 3)
      super(file_prefix: file_prefix, file_extension: 'rb', minimum_churn_count: minimum_churn_count)
      @type = "Ruby"
    end

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attractor-1.1.0 lib/attractor/calculators/ruby_calculator.rb