Class: Drnbench::Chart::Gnuplot

Inherits:
Object
  • Object
show all
Defined in:
lib/drnbench/chart/gnuplot.rb

Instance Method Summary collapse

Constructor Details

#initializeGnuplot

Returns a new instance of Gnuplot.



21
22
23
24
# File 'lib/drnbench/chart/gnuplot.rb', line 21

def initialize
  @input = Tempfile.new("drnbench-graph")
  write(preamble)
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
# File 'lib/drnbench/chart/gnuplot.rb', line 30

def run
  @input.close
  unless system("gnuplot", @input.path)
    @input.open
    puts(@input.read)
    @input.close
  end
end

#write(data) ⇒ Object



26
27
28
# File 'lib/drnbench/chart/gnuplot.rb', line 26

def write(data)
  @input.write(data)
end