class Roby::Plan::Trigger

@api private

A trigger created by {Plan#add_trigger}

Attributes

block[R]

The block that will be called if {#query} matches

query[R]

The query that is being watched

Public Class Methods

new(query, block) click to toggle source
# File lib/roby/plan.rb, line 962
def initialize(query, block)
    @query = query.query
    @block = block
end

Public Instance Methods

===(task) click to toggle source

Whether self would be triggering on task

@param [Roby::Task] task @return [Boolean]

# File lib/roby/plan.rb, line 971
def ===(task)
    query === task
end
call(task) click to toggle source

Call the trigger's observer for the given task

# File lib/roby/plan.rb, line 986
def call(task)
    block.call(task)
end
each(plan, &block) click to toggle source

Lists the tasks that match the query

@param [Plan] plan @yieldparam [Roby::Task] task tasks that match {#query}

# File lib/roby/plan.rb, line 979
def each(plan, &block)
    query.plan = plan
    query.reset
    query.each(&block)
end