Class: Roby::Plan::Trigger Private

Inherits:
Object show all
Defined in:
lib/roby/plan.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A trigger created by #add_trigger

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query, block) ⇒ Trigger

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Trigger.



1156
1157
1158
1159
# File 'lib/roby/plan.rb', line 1156

def initialize(query, block)
    @query = query.query
    @block = block
end

Instance Attribute Details

#blockObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The block that will be called if #query matches



1154
1155
1156
# File 'lib/roby/plan.rb', line 1154

def block
  @block
end

#queryObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The query that is being watched



1152
1153
1154
# File 'lib/roby/plan.rb', line 1152

def query
  @query
end

Instance Method Details

#===(task) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Whether self would be triggering on task

Parameters:

Returns:

  • (Boolean)


1165
1166
1167
# File 'lib/roby/plan.rb', line 1165

def ===(task)
    query === task
end

#call(task) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Call the trigger’s observer for the given task



1180
1181
1182
# File 'lib/roby/plan.rb', line 1180

def call(task)
    block.call(task)
end

#each(plan) {|task| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Lists the tasks that match the query

Parameters:

Yield Parameters:



1173
1174
1175
1176
1177
# File 'lib/roby/plan.rb', line 1173

def each(plan, &block)
    query.plan = plan
    query.reset
    query.each(&block)
end