Sha256: 17d4c56a440a66fec8071c3691193d2c524b8331311ac86824c95d845e04ad52

Contents?: true

Size: 818 Bytes

Versions: 10

Compression:

Stored size: 818 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')].sort.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

10 entries across 10 versions & 4 rubygems

Version Path
edouard-metric_fu-1.0.2 lib/base/graph.rb
edouard-metric_fu-1.0.4.2 lib/base/graph.rb
edouard-metric_fu-1.0.4.3 lib/base/graph.rb
edouard-metric_fu-1.0.4.4 lib/base/graph.rb
edouard-metric_fu-1.0.4.5 lib/base/graph.rb
edouard-metric_fu-1.1.1 lib/base/graph.rb
jscruggs-metric_fu-1.1.0 lib/base/graph.rb
jscruggs-metric_fu-1.1.1 lib/base/graph.rb
mwilden-metric_fu-1.1.1 lib/base/graph.rb
nielsm-metric_fu-1.1.1 lib/base/graph.rb