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.



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

def initialize(value)
    @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



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

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

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

Returns:

  • (Boolean)


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

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

#evaluate_delayed_argument(task) ⇒ Object



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

def evaluate_delayed_argument(task)
    value
end

#merge(task, other_task, other_arg) ⇒ Object



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

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



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

def pretty_print(pp)
    pp.text to_s
end

#strong?Boolean

Returns:

  • (Boolean)


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

def strong?
    false
end

#to_sObject



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

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