Sha256: 5ff982579f436b2bcb23c484a90e6e7a2fdbc74f21d4787b3ab6e2f7e9a335c7

Contents?: true

Size: 821 Bytes

Versions: 6

Compression:

Stored size: 821 Bytes

Contents

module MetricFu

  class ChurnGenerator < Generator

    def self.metric
      :churn
    end

    ###
    # options available are what can be passed to churn_calculator
    # https://github.com/danmayer/churn#library-options
    ###
    def emit
      @output = run(options)
    end

    def analyze
      if @output.nil? || @output.size.zero?
        @churn = {:churn => {}}
      else
        @churn = @output
      end
      @churn
    end

    # ensure hash only has the :churn key
    def to_h
      {:churn => @churn[:churn]}
    end

    # @param args [Hash] churn metric run options
    # @return [Hash] churn results
    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

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
metric_fu-4.11.3 lib/metric_fu/metrics/churn/generator.rb
metric_fu-4.11.2 lib/metric_fu/metrics/churn/generator.rb
metric_fu-4.11.1 lib/metric_fu/metrics/churn/generator.rb
metric_fu-4.11.0 lib/metric_fu/metrics/churn/generator.rb
metric_fu-4.10.0 lib/metric_fu/metrics/churn/churn.rb
metric_fu-4.9.0 lib/metric_fu/metrics/churn/churn.rb