Class: MetricFu::Stats

Inherits:
Generator show all
Defined in:
lib/generators/stats.rb

Instance Attribute Summary

Attributes inherited from Generator

#report, #template

Instance Method Summary collapse

Methods inherited from Generator

class_name, #create_data_dir_if_missing, #create_metric_dir_if_missing, #create_output_dir_if_missing, generate_report, #generate_report, #initialize, #metric_directory, metric_directory, #remove_excluded_files, #round_to_tenths, #to_graph

Constructor Details

This class inherits a constructor from MetricFu::Generator

Instance Method Details

#analyzeObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/generators/stats.rb', line 9

def analyze
  output = File.open(metric_directory + '/stats.txt').read
  lines = remove_noise(output)

  @stats = {}
  
  set_global_stats(lines.pop)
  set_granular_stats(lines)

  @stats
end

#emitObject



5
6
7
# File 'lib/generators/stats.rb', line 5

def emit
  `rake stats > #{metric_directory + '/stats.txt'}`
end

#to_hObject



21
22
23
# File 'lib/generators/stats.rb', line 21

def to_h
  {:stats => @stats}
end