Class: MetricFu::ChurnGenerator
- Defined in:
- lib/metric_fu/metrics/churn/generator.rb
Instance Attribute Summary
Attributes inherited from Generator
Class Method Summary collapse
Instance Method Summary collapse
- #analyze ⇒ Object
-
#emit ⇒ Object
options available are what can be passed to churn_calculator github.com/danmayer/churn#library-options.
-
#run(args) ⇒ Hash
Churn results.
-
#to_h ⇒ Object
ensure hash only has the :churn key.
Methods inherited from Generator
#generate_result, generators, get_generator, #initialize, #metric, #metric_config, metric_directory, #metric_directory, not_implemented, #remove_excluded_files, #round_to_tenths, #run!
Constructor Details
This class inherits a constructor from MetricFu::Generator
Class Method Details
.metric ⇒ Object
3 4 5 |
# File 'lib/metric_fu/metrics/churn/generator.rb', line 3 def self.metric :churn end |
Instance Method Details
#analyze ⇒ Object
15 16 17 18 19 20 21 22 |
# 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 ⇒ Object
options available are what can be passed to churn_calculator github.com/danmayer/churn#library-options
11 12 13 |
# File 'lib/metric_fu/metrics/churn/generator.rb', line 11 def emit @output = run() end |
#run(args) ⇒ Hash
Returns churn results.
31 32 33 34 35 |
# 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 ⇒ Object
ensure hash only has the :churn key
25 26 27 |
# File 'lib/metric_fu/metrics/churn/generator.rb', line 25 def to_h { churn: @churn[:churn] } end |