Sha256: 4784aeb3c29ae0328a77cc6be5ee8e4ef2a7c8b5994a87b405721eb9f4b7b217

Contents?: true

Size: 813 Bytes

Versions: 2

Compression:

Stored size: 813 Bytes

Contents

module MetricFu

  def self.graph
    @graph ||= Graph.new
  end

  class Graph
    
    attr_accessor :clazz
    
    def initialize
      self.clazz = []
    end
    
    def add(graph_type)
      grapher_name = graph_type.to_s.capitalize + "Grapher"
      self.clazz.push MetricFu.const_get(grapher_name).new
    end
    
    
    def generate
      puts "Generating graphs"
      Dir[File.join(MetricFu.data_directory, '*.yml')].each do |metric_file|
        puts "Generating graphs for #{metric_file}"
        date = metric_file.split('/')[3].split('.')[0]
        metrics = YAML::load(File.open(metric_file))
        
        self.clazz.each do |grapher|
          grapher.get_metrics(metrics, date)
        end
      end
      self.clazz.each do |grapher|
        grapher.graph!
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
edouard-metric_fu-1.0.4.1 lib/base/graph.rb
edouard-metric_fu-1.0.4 lib/base/graph.rb