Class: Drnbench::Chart::Gnuplot
- Inherits:
-
Object
- Object
- Drnbench::Chart::Gnuplot
- Defined in:
- lib/drnbench/chart/gnuplot.rb
Instance Method Summary collapse
-
#initialize ⇒ Gnuplot
constructor
A new instance of Gnuplot.
- #run ⇒ Object
- #write(data) ⇒ Object
Constructor Details
#initialize ⇒ Gnuplot
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
#run ⇒ Object
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 |