class Roby::EventGenerator::EventHandler
Class
used to register event handler blocks along with their options
Attributes
block[R]
Public Class Methods
new(block, copy_on_replace, once)
click to toggle source
# File lib/roby/event_generator.rb, line 287 def initialize(block, copy_on_replace, once) @block, @copy_on_replace, @once = block, copy_on_replace, once end
Public Instance Methods
==(other)
click to toggle source
# File lib/roby/event_generator.rb, line 314 def ==(other) @copy_on_replace == other.copy_on_replace? && @once == other.once? && block == other.block end
as_options()
click to toggle source
Generates an option hash valid for EventGenerator#on
# File lib/roby/event_generator.rb, line 306 def as_options mode = if copy_on_replace? then :copy else :drop end { on_replace: mode, once: once? } end
call(*args)
click to toggle source
# File lib/roby/event_generator.rb, line 291 def call(*args) block.call(*args) end
copy_on_replace?()
click to toggle source
True if this event handler should be moved to the new task in case of replacements
The default in Task#on
is false for non-abstract tasks and true for abstract tasks.
# File lib/roby/event_generator.rb, line 300 def copy_on_replace?; !!@copy_on_replace end
once?()
click to toggle source
True if this event handler should be called only once
# File lib/roby/event_generator.rb, line 303 def once?; !!@once end