Class: Roby::Planning::MethodDefinition
- Includes:
- MethodInheritance
- Defined in:
- lib/roby/planning/model.rb
Overview
An implementation of a planning method.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#call(planner) ⇒ Object
Call the method definition.
-
#id ⇒ Object
The method ID.
-
#initialize(name, options, body) ⇒ MethodDefinition
constructor
A new instance of MethodDefinition.
-
#recursive? ⇒ Boolean
If this method handles recursion.
-
#returns ⇒ Object
What kind of task this method returns.
-
#reuse? ⇒ Boolean
If the method allows reusing tasks already in the plan reuse? is always false if there is no return type defined.
- #to_s ⇒ Object
Methods included from MethodInheritance
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, , body) @name, @options, @body = name, , body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
113 114 115 |
# File 'lib/roby/planning/model.rb', line 113 def body @body end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
113 114 115 |
# File 'lib/roby/planning/model.rb', line 113 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
113 114 115 |
# File 'lib/roby/planning/model.rb', line 113 def @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 |
#recursive? ⇒ Boolean
If this method handles recursion
121 |
# File 'lib/roby/planning/model.rb', line 121 def recursive?; [:recursive] end |
#returns ⇒ Object
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; [: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
129 |
# File 'lib/roby/planning/model.rb', line 129 def reuse?; (!.has_key?(:reuse) || [:reuse]) if returns end |
#to_s ⇒ Object
133 |
# File 'lib/roby/planning/model.rb', line 133 def to_s; "#{name}:#{id}(#{})" end |