class Roby::Interface::Client::BatchContext
@api private
Object
used to gather commands in a batch
Public Class Methods
new(context)
click to toggle source
Creates a new batch context
@param [Object] context the underlying interface object
# File lib/roby/interface/client.rb, line 363 def initialize(context) @context = context @calls = ::Array.new end
Public Instance Methods
__calls()
click to toggle source
The set of operations that have been gathered so far
# File lib/roby/interface/client.rb, line 373 def __calls @calls end
__process()
click to toggle source
Process the batch and return the list of return values for all the calls in {#__calls}
# File lib/roby/interface/client.rb, line 426 def __process @context.process_batch(self) end
__push(path, m, *args)
click to toggle source
Pushes an operation in the batch
# File lib/roby/interface/client.rb, line 378 def __push(path, m, *args) @calls << [path, m, *args] end
drop_job(job_id)
click to toggle source
Drop the given job within the batch
Note that as all batch operations, order does NOT matter
# File lib/roby/interface/client.rb, line 398 def drop_job(job_id) __push([], :drop_job, job_id) end
empty?()
click to toggle source
# File lib/roby/interface/client.rb, line 368 def empty? @calls.empty? end
kill_job(job_id)
click to toggle source
Kill the given job within the batch
Note that as all batch operations, order does NOT matter
# File lib/roby/interface/client.rb, line 405 def kill_job(job_id) __push([], :kill_job, job_id) end
method_missing(m, *args)
click to toggle source
@api private
Provides the action_name! syntax to start jobs
# File lib/roby/interface/client.rb, line 416 def method_missing(m, *args) if m =~ /(.*)!$/ start_job($1, *args) else ::Kernel.raise ::NoMethodError.new(m), "#{m} either does not exist, or is not supported in batch context (only starting and killing jobs is)" end end
respond_to_missing?(m, include_private)
click to toggle source
Calls superclass method
# File lib/roby/interface/client.rb, line 409 def respond_to_missing?(m, include_private) (m =~ /(.*)!$/) || super end
start_job(action_name, *args)
click to toggle source
Start the given job within the batch
Note that as all batch operations, order does NOT matter
@raise [NoSuchAction] if the action does not exist
# File lib/roby/interface/client.rb, line 387 def start_job(action_name, *args) if @context.has_action?(action_name) __push([], :start_job, action_name, *args) else ::Kernel.raise ::Roby::Interface::Client::NoSuchAction, "there is no action called #{action_name} on #{@context}" end end