Class: MetricFu::Graph

Inherits:
Object
  • Object
show all
Defined in:
lib/base/graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGraph

Returns a new instance of Graph.



11
12
13
# File 'lib/base/graph.rb', line 11

def initialize
  self.clazz = []
end

Instance Attribute Details

#clazzObject

Returns the value of attribute clazz.



9
10
11
# File 'lib/base/graph.rb', line 9

def clazz
  @clazz
end

Instance Method Details

#add(graph_type, graph_engine) ⇒ Object



15
16
17
18
# File 'lib/base/graph.rb', line 15

def add(graph_type, graph_engine)
  grapher_name = graph_type.to_s.capitalize + graph_engine.to_s.capitalize + "Grapher"
  self.clazz.push MetricFu.const_get(grapher_name).new
end

#generateObject



21
22
23
24
25
26
# File 'lib/base/graph.rb', line 21

def generate
  return if self.clazz.empty?
  puts "Generating graphs"
  graphed_reports.each { |report| process_report(report) }
  self.clazz.each { |grapher| grapher.graph! }
end