Class: Roby::DelayedArgumentFromState
- Inherits:
-
DelayedArgumentFromObject
- Object
- DelayedArgumentFromObject
- Roby::DelayedArgumentFromState
- Defined in:
- lib/roby/task_arguments.rb
Overview
Placeholder that can be used to assign an argument from a state value, reading the attribute only when the task is started
This will usually not be used directly. One should use Task.from_state instead
It differs from DelayedArgumentFromObject as it always filters out unassigned state values
Instance Method Summary collapse
- #can_merge?(task, other_task, other_arg) ⇒ Boolean
- #evaluate_delayed_argument(task) ⇒ Object
-
#initialize(state_object = State, weak = true) ⇒ DelayedArgumentFromState
constructor
A new instance of DelayedArgumentFromState.
- #merge(task, other_task, other_arg) ⇒ Object
- #strong? ⇒ Boolean
Methods inherited from DelayedArgumentFromObject
#==, #__expected_class__, #__methods__, #__object__, #add_method, #method_missing, #of_type, #of_type!, #pretty_print, #to_s
Methods included from Roby::DRoby::V5::Builtins::ClassDumper
Methods included from Roby::DRoby::V5::DelayedArgumentFromObjectDumper
Constructor Details
#initialize(state_object = State, weak = true) ⇒ DelayedArgumentFromState
Returns a new instance of DelayedArgumentFromState.
706 707 708 |
# File 'lib/roby/task_arguments.rb', line 706 def initialize(state_object = State, weak = true) super(state_object, weak) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Roby::DelayedArgumentFromObject
Instance Method Details
#can_merge?(task, other_task, other_arg) ⇒ Boolean
714 715 716 717 718 719 720 |
# File 'lib/roby/task_arguments.rb', line 714 def can_merge?(task, other_task, other_arg) if other_arg.kind_of?(DelayedArgumentFromState) other_arg == self else super end end |
#evaluate_delayed_argument(task) ⇒ Object
734 735 736 737 738 739 740 |
# File 'lib/roby/task_arguments.rb', line 734 def evaluate_delayed_argument(task) result = super if result.kind_of?(OpenStruct) && !result.attached? throw :no_value end result end |
#merge(task, other_task, other_arg) ⇒ Object
722 723 724 725 726 727 728 729 730 731 732 |
# File 'lib/roby/task_arguments.rb', line 722 def merge(task, other_task, other_arg) case other_arg when TaskArguments::StaticArgumentWrapper other_arg.value else catch(:no_value) do return evaluate_delayed_argument(task) end self end end |
#strong? ⇒ Boolean
710 711 712 |
# File 'lib/roby/task_arguments.rb', line 710 def strong? true end |