Class: Roby::Planning::MethodDefinition

Inherits:
Object
  • Object
show all
Includes:
MethodInheritance
Defined in:
lib/roby/planning/model.rb

Overview

An implementation of a planning method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MethodInheritance

#validate

Constructor Details

#initialize(name, options, body) ⇒ MethodDefinition

Returns a new instance of MethodDefinition.



114
115
116
# File 'lib/roby/planning/model.rb', line 114

def initialize(name, options, body)
    @name, @options, @body = name, options, body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



113
114
115
# File 'lib/roby/planning/model.rb', line 113

def body
  @body
end

#nameObject (readonly)

Returns the value of attribute name.



113
114
115
# File 'lib/roby/planning/model.rb', line 113

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



113
114
115
# File 'lib/roby/planning/model.rb', line 113

def options
  @options
end

Instance Method Details

#call(planner) ⇒ Object

Call the method definition



131
# File 'lib/roby/planning/model.rb', line 131

def call(planner); body.call(planner) end

#idObject

The method ID



119
# File 'lib/roby/planning/model.rb', line 119

def id;         options[:id] end

#recursive?Boolean

If this method handles recursion

Returns:

  • (Boolean)


121
# File 'lib/roby/planning/model.rb', line 121

def recursive?; options[:recursive] end

#returnsObject

What kind of task this method returns

If this is nil, the method may return a task array or a task aggregation



126
# File 'lib/roby/planning/model.rb', line 126

def returns;    options[:returns] end

#reuse?Boolean

If the method allows reusing tasks already in the plan reuse? is always false if there is no return type defined

Returns:

  • (Boolean)


129
# File 'lib/roby/planning/model.rb', line 129

def reuse?; (!options.has_key?(:reuse) || options[:reuse]) if returns end

#to_sObject



133
# File 'lib/roby/planning/model.rb', line 133

def to_s; "#{name}:#{id}(#{options})" end