class MetricFu::ChurnGenerator

Public Class Methods

metric() click to toggle source
# File lib/metric_fu/metrics/churn/generator.rb, line 3
def self.metric
  :churn
end

Public Instance Methods

analyze() click to toggle source
# File lib/metric_fu/metrics/churn/generator.rb, line 15
def analyze
  if @output.nil? || @output.size.zero?
    @churn = { churn: {} }
  else
    @churn = @output
  end
  @churn
end
emit() click to toggle source

options available are what can be passed to churn_calculator github.com/danmayer/churn#library-options

# File lib/metric_fu/metrics/churn/generator.rb, line 11
def emit
  @output = run(options)
end
run(args) click to toggle source

@param args [Hash] churn metric run options @return [Hash] churn results

# File lib/metric_fu/metrics/churn/generator.rb, line 31
def run(args)
  # @note passing in false to report will return a hash
  #    instead of the default String
  ::Churn::ChurnCalculator.new(args).report(false)
end
to_h() click to toggle source

ensure hash only has the :churn key

# File lib/metric_fu/metrics/churn/generator.rb, line 25
def to_h
  { churn: @churn[:churn] }
end