Class: MetricFu::Grapher

Inherits:
Object
  • Object
show all
Defined in:
lib/metric_fu/reporting/graphs/grapher.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Grapher

Returns a new instance of Grapher.



20
21
22
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 20

def initialize(opts = {})
  self.output_directory = opts[:output_directory]
end

Instance Attribute Details

#output_directoryObject

Returns the value of attribute output_directory.



18
19
20
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 18

def output_directory
  @output_directory
end

Class Method Details

.get_grapher(metric) ⇒ Object



14
15
16
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 14

def self.get_grapher(metric)
  graphers.find { |grapher|grapher.metric.to_s == metric.to_s }
end

.graphersObject

Returns all subclassed graphers [Array<MetricFu::Grapher>].

Returns:

  • all subclassed graphers [Array<MetricFu::Grapher>]



6
7
8
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 6

def self.graphers
  @graphers
end

Instance Method Details

#dateObject



46
47
48
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 46

def date
  not_implemented
end

#get_metrics(_metrics, _sortable_prefix) ⇒ Object



28
29
30
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 28

def get_metrics(_metrics, _sortable_prefix)
  not_implemented
end

#graph!Object



32
33
34
35
36
37
38
39
40
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 32

def graph!
  labels = MultiJson.dump(@labels)
  content = <<-EOS
    var graph_title = '#{title}';
    #{build_data(data)}
    var graph_labels = #{labels};
  EOS
  File.open(File.join(output_directory, "results", output_filename), "w") { |f| f << content }
end

#output_filenameObject



50
51
52
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 50

def output_filename
  not_implemented
end

#titleObject



42
43
44
# File 'lib/metric_fu/reporting/graphs/grapher.rb', line 42

def title
  not_implemented
end