Method: GnuplotRB::Plottable#to_specific_term
- Defined in:
- lib/gnuplotrb/mixins/plottable.rb
#to_specific_term(terminal, path = nil, **options) ⇒ Object
Output plot to specific terminal (possibly some file). Explicit use should be avoided. This method is called from #method_missing when it handles method names like #to_png(options).
109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/gnuplotrb/mixins/plottable.rb', line 109 def to_specific_term(terminal, path = nil, **) if path result = plot(term: [terminal, ], output: path) else path = Dir::Tmpname.make_tmpname(terminal, 0) plot(term: [terminal, ], output: path) result = File.binread(path) File.delete(path) end result end |