Class: NumPlot::YesNoOption

Inherits:
Object
  • Object
show all
Defined in:
lib/numplot/option.rb

Overview

The class handling XXX/noXXX options on gnuplot command

Instance Method Summary (collapse)

Constructor Details

- (YesNoOption) initialize(name)

A new instance of YesNoOption



65
66
67
68
# File 'lib/numplot/option.rb', line 65

def initialize(name)
  @name = name
  @no_name = "no#{name}".intern
end

Instance Method Details

- (Object) plot_arg(h)



70
71
72
73
74
75
76
# File 'lib/numplot/option.rb', line 70

def plot_arg(h)
  return " #{@name}" if h.has_key?(@name) && h[@name]
  return " #{@name}" if h.has_key?(@no_name) && !h[@no_name]
  return " #{@no_name}" if h.has_key?(@no_name) && h[@no_name]
  return " #{@no_name}" if h.has_key?(@name) && !h[@name]
  ""
end