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.



1160
1161
1162
1163
# File 'lib/roby/plan.rb', line 1160

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



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

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



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

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)


1169
1170
1171
# File 'lib/roby/plan.rb', line 1169

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



1184
1185
1186
# File 'lib/roby/plan.rb', line 1184

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:



1177
1178
1179
1180
1181
# File 'lib/roby/plan.rb', line 1177

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