lib/gnuplotrb/mixins/plottable.rb
##
# In this gem #method_missing is used both to handle
# options and to handle plotting to specific terminal.
#
# == Options handling
# === Overview
# You may set options using #option_name(option_value) method.
# A new object will be constructed with selected option set.
# And finally you can get current value of any option using
# #options_name without arguments.
# === Arguments
# * *option_value* - value to set an option. If none given
#   method will just return current option's value
# === Examples
#   plot = Splot.new
#   new_plot = plot.title('Awesome plot')
#   plot.title #=> nil
#   new_plot.title #=> 'Awesome plot'
#
# == Plotting to specific term
# === Overview
# Gnuplot offers possibility to output graphics to many image formats.
# The easiest way to to so is to use #to_<plot_name> methods.
# === Arguments
# * *options* - set of options related to terminal (size, font etc).
#   Be careful, some terminals have their own specific options.
# === Examples
#   # font options specific for png term
#   multiplot.to_png('./result.png', size: [300, 500], font: ['arial', 12])
#   # font options specific for svg term
#   content = multiplot.to_svg(size: [100, 100], fname: 'Arial', fsize: 12)
In this gem #method_missing is used both to handle
options and to handle plotting to specific terminal.

Options handling
Overview
You may set options using #option_name(option_value) method.
A new object will be constructed with selected option set.
And finally you can get current value of any option using
options_name without arguments.
Arguments
*option_value* - value to set an option.

Plotting to specific term
Overview
Gnuplot offers possibility to output graphics to many image formats.
The easiest way to to so is to use #to_ methods.
Arguments
*options* - set of options related to terminal (size, font etc).
Be careful, some terminals have their own specific options.
In this gem #method_missing is used both to handle options and to handle plotting to specific terminal . Options handling Overview You may set options using #option_name ( option_value ) method . A new object will be constructed with selected option set . And finally you can get current value of any option using options_name without arguments . Arguments * option_value * - value to set an option . Plotting to specific term Overview Gnuplot offers possibility to output graphics to many image formats . The easiest way to to so is to use #to_ methods . Arguments * options * - set of options related to terminal ( size font etc ) . Be careful some terminals have their own specific options .
def method_missing(meth_id, *args)
      meth = meth_id.id2name
      case
      when meth[0..2] == 'to_'
        term = meth[3..-1]
        super unless OptionHandling.valid_terminal?(term)
        to_specific_term(term, *args)
      when meth[-1] == '!'
        option!(meth[0..-2].to_sym, *args)
      when meth[-1] == '='
        option!(meth[0..-2].to_sym, *args)
        option(meth[0..-2].to_sym)
      else
        option(meth_id, *args)
      end
    end
def method_missing ( meth_id , * args ) meth = meth_id . id2name case when meth [ 0 .. 2 ] == 'to_' term = meth [ 3 .. - 1 ] super unless OptionHandling . valid_terminal? ( term ) to_specific_term ( term , * args ) when meth [ - 1 ] == '!' option! ( meth [ 0 .. - 2 ] . to_sym , * args ) when meth [ - 1 ] == '=' option! ( meth [ 0 .. - 2 ] . to_sym , * args ) option ( meth [ 0 .. - 2 ] . to_sym ) else option ( meth_id , * args ) end end
In this gem #method_missing is used both to handle
options and to handle plotting to specific terminal.
In this gem #method_missing is used both to handle options and to handle plotting to specific terminal .
meth_id
<not_specific>
args
<not_specific>