Class: Roby::Interface::Client::BatchContext::Return Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/roby/interface/client.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Element

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Enumerable

#empty?

Constructor Details

#initialize(elements) ⇒ Return

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Return.



442
443
444
# File 'lib/roby/interface/client.rb', line 442

def initialize(elements)
    @elements = elements
end

Class Method Details

.from_calls_and_return(calls, return_values) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



435
436
437
438
439
440
# File 'lib/roby/interface/client.rb', line 435

def self.from_calls_and_return(calls, return_values)
    elements = calls.zip(return_values).map do |c, r|
        Element.new(c, r)
    end
    new(elements)
end

Instance Method Details

#[](index) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



455
456
457
# File 'lib/roby/interface/client.rb', line 455

def [](index)
    @elements[index].return_value
end

#call_at(index) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



459
460
461
# File 'lib/roby/interface/client.rb', line 459

def call_at(index)
    @elements[index].call
end

#dropped_jobs_idObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



483
484
485
486
# File 'lib/roby/interface/client.rb', line 483

def dropped_jobs_id
    filter(call: :drop_job).each_element.
        map { |e| e.call[2] }
end

#each(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



446
447
448
449
# File 'lib/roby/interface/client.rb', line 446

def each(&block)
    return enum_for(__method__) if !block_given?
    @elements.each { |e| yield(e.return_value) }
end

#each_element(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



451
452
453
# File 'lib/roby/interface/client.rb', line 451

def each_element(&block)
    @elements.each(&block)
end

#filter(call: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



467
468
469
470
471
472
# File 'lib/roby/interface/client.rb', line 467

def filter(call: nil)
    filtered = @elements.find_all do |e|
        e.call[1] == call
    end
    Return.new(filtered)
end

#killed_jobs_idObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



478
479
480
481
# File 'lib/roby/interface/client.rb', line 478

def killed_jobs_id
    filter(call: :kill_job).each_element.
        map { |e| e.call[2] }
end

#return_value_at(index) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



463
464
465
# File 'lib/roby/interface/client.rb', line 463

def return_value_at(index)
    @elements[index].return_value
end

#started_jobs_idObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



474
475
476
# File 'lib/roby/interface/client.rb', line 474

def started_jobs_id
    filter(call: :start_job).to_a
end