module Rubinius::Grapher

Constants

VERSION

Public Class Methods

graph() click to toggle source
# File lib/rubinius/grapher.rb, line 75
def self.graph
  filename = ARGV.shift

  contents = File.readlines filename
  metrics = contents.shift.chomp.split ", "

  rows = contents.map { |x| x.chomp.split.map { |n| n.to_i } }

  data = { }

  metrics.each_with_index do |m, i|
    data[m] = rows.map { |r| r[i] }
  end

  width = Rubinius::TERMINAL_WIDTH
  height = 12

  graphs = data.map do |t, d|
    AsciiGraph.new width, height, t, d
  end

  graphs.sort! { |a, b| a.title <=> b.title }

  graphs.each { |g| puts g.plot.to_s }
end