Class: Roby::DefaultArgument

Inherits:
Object
  • Object
show all
Includes:
Roby::DRoby::V5::DefaultArgumentDumper
Defined in:
lib/roby/task_arguments.rb,
lib/roby/droby/enable.rb

Overview

Placeholder that can be used as an argument to represent a default value

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Roby::DRoby::V5::DefaultArgumentDumper

#droby_dump

Constructor Details

#initialize(value) ⇒ DefaultArgument

Returns a new instance of DefaultArgument.



526
527
528
# File 'lib/roby/task_arguments.rb', line 526

def initialize(value)
    @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



524
525
526
# File 'lib/roby/task_arguments.rb', line 524

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



558
559
560
561
# File 'lib/roby/task_arguments.rb', line 558

def ==(other)
    other.kind_of?(self.class) &&
        other.value == value
end

#can_merge?(task, other_task, other_arg) ⇒ Boolean

Returns:

  • (Boolean)


538
539
540
# File 'lib/roby/task_arguments.rb', line 538

def can_merge?(task, other_task, other_arg)
    true
end

#evaluate_delayed_argument(task) ⇒ Object



530
531
532
# File 'lib/roby/task_arguments.rb', line 530

def evaluate_delayed_argument(task)
    value
end

#merge(task, other_task, other_arg) ⇒ Object



542
543
544
545
546
547
548
# File 'lib/roby/task_arguments.rb', line 542

def merge(task, other_task, other_arg)
    if other_arg.kind_of?(DefaultArgument) # backward-compatible behavior
        self
    else
        other_arg
    end
end

#pretty_print(pp) ⇒ Object



550
551
552
# File 'lib/roby/task_arguments.rb', line 550

def pretty_print(pp)
    pp.text to_s
end

#strong?Boolean

Returns:

  • (Boolean)


534
535
536
# File 'lib/roby/task_arguments.rb', line 534

def strong?
    false
end

#to_sObject



554
555
556
# File 'lib/roby/task_arguments.rb', line 554

def to_s
    "default(#{value.nil? ? 'nil' : value})"
end