Class: MetricFu::Graph

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGraph

Returns a new instance of Graph.



9
10
11
# File 'lib/metric_fu/reporting/graphs/graph.rb', line 9

def initialize
  self.graphers = []
end

Instance Attribute Details

#graphersObject

Returns the value of attribute graphers.



7
8
9
# File 'lib/metric_fu/reporting/graphs/graph.rb', line 7

def graphers
  @graphers
end

Instance Method Details

#add(metric_name, _graph_engine, output_directory = MetricFu::Io::FileSystem.directory("output_directory")) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/metric_fu/reporting/graphs/graph.rb', line 13

def add(metric_name, _graph_engine, output_directory = MetricFu::Io::FileSystem.directory("output_directory"))
  grapher = MetricFu::Grapher.get_grapher(metric_name).
            new.tap { |g| g.output_directory = output_directory }
  graphers.push grapher
rescue NameError => e
  mf_log "#{e.message} called in MetricFu::Graph.add with #{graph_type}"
end

#generateObject



21
22
23
24
25
26
27
28
# File 'lib/metric_fu/reporting/graphs/graph.rb', line 21

def generate
  return if graphers.empty?
  mf_log "Generating graphs"
  generate_graphs_for_files
  graph!
rescue NameError => e
  mf_log "#{e.message} called in MetricFu::Graph generate"
end