class Roby::Coordination::Models::Capture
Object
that is used to represent the context of an event context
Attributes
name[RW]
The capture name
Only used for debugging purposes
@return [String]
Public Class Methods
new(filter = lambda { |event| event.context })
click to toggle source
Create a new capture object
@param [#call] filter an object that is used to process the
event's context. It is passed the context as-is (i.e. as an array) and should return the value that should be captured
# File lib/roby/coordination/models/capture.rb, line 18 def initialize(filter = lambda { |event| event.context }) @filter = filter end
Public Instance Methods
evaluate(variables)
click to toggle source
Evaluate the capture
@param [Hash] variables the underlying coordination object's
bound variables
@raise Unbound
if the capture's backing event has not yet been
emitted
# File lib/roby/coordination/models/capture.rb, line 71 def evaluate(variables) if variables.has_key?(self) variables[self] else raise Unbound.new(self), "#{self} is not bound yet" end end
evaluate_delayed_argument(task)
click to toggle source
# File lib/roby/coordination/models/capture.rb, line 61 def evaluate_delayed_argument(task) throw :no_value end
filter(state_machine, event)
click to toggle source
Filter the context through the filter object passed to {#initialize}
# File lib/roby/coordination/models/capture.rb, line 24 def filter(state_machine, event) CaptureEvaluationContext.new(state_machine). instance_exec(event, &@filter) end
to_s()
click to toggle source
# File lib/roby/coordination/models/capture.rb, line 79 def to_s "capture:#{name || '<unnamed>'}" end