Class: RedPlot::ToDraw

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

Overview

helper class to store callbacks to the data and plot command options

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeToDraw

Returns a new instance of ToDraw.



44
45
46
# File 'lib/redplot.rb', line 44

def initialize
  reinit
end

Instance Attribute Details

#callbacksObject (readonly)

Returns the value of attribute callbacks.



43
44
45
# File 'lib/redplot.rb', line 43

def callbacks
  @callbacks
end

#optionsObject (readonly)

Returns the value of attribute options.



43
44
45
# File 'lib/redplot.rb', line 43

def options
  @options
end

Instance Method Details

#add(option = "", &block) ⇒ Object

main client method expects a callback block that return an object with access to data to plat different object are possible (cf Plotter#formatdata)



54
55
56
57
58
59
60
# File 'lib/redplot.rb', line 54

def add(option="", &block)
  unless block.nil?
    @options    << option
    @callbacks  << block
  end
  self
end

#reinitObject Also known as: clear



47
48
49
50
# File 'lib/redplot.rb', line 47

def reinit
  @options, @callbacks = [], []
  self
end