Class: Roby::Interface::Client::BatchContext Private
- Inherits:
- BasicObject
- Defined in:
- lib/roby/interface/client.rb
Overview
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.
Object used to gather commands in a batch
Defined Under Namespace
Classes: Return
Instance Method Summary collapse
-
#__calls ⇒ Object
private
The set of operations that have been gathered so far.
-
#__process ⇒ Object
private
Process the batch and return the list of return values for all the calls in #__calls.
-
#__push(path, m, *args) ⇒ Object
private
Pushes an operation in the batch.
-
#drop_job(job_id) ⇒ Object
private
Drop the given job within the batch.
- #empty? ⇒ Boolean private
-
#initialize(context) ⇒ BatchContext
constructor
private
Creates a new batch context.
-
#kill_job(job_id) ⇒ Object
private
Kill the given job within the batch.
-
#method_missing(m, *args) ⇒ Object
private
Provides the action_name! syntax to start jobs.
- #respond_to_missing?(m, include_private) ⇒ Boolean private
-
#start_job(action_name, *args) ⇒ Object
private
Start the given job within the batch.
Constructor Details
#initialize(context) ⇒ BatchContext
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.
Creates a new batch context
363 364 365 366 |
# File 'lib/roby/interface/client.rb', line 363 def initialize(context) @context = context @calls = ::Array.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ 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.
Provides the action_name! syntax to start jobs
416 417 418 419 420 421 422 |
# 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 |
Instance Method Details
#__calls ⇒ 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.
The set of operations that have been gathered so far
373 374 375 |
# File 'lib/roby/interface/client.rb', line 373 def __calls @calls end |
#__process ⇒ 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.
Process the batch and return the list of return values for all the calls in #__calls
426 427 428 |
# File 'lib/roby/interface/client.rb', line 426 def __process @context.process_batch(self) end |
#__push(path, m, *args) ⇒ 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.
Pushes an operation in the batch
378 379 380 |
# File 'lib/roby/interface/client.rb', line 378 def __push(path, m, *args) @calls << [path, m, *args] end |
#drop_job(job_id) ⇒ 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.
Drop the given job within the batch
Note that as all batch operations, order does NOT matter
398 399 400 |
# File 'lib/roby/interface/client.rb', line 398 def drop_job(job_id) __push([], :drop_job, job_id) end |
#empty? ⇒ Boolean
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.
368 369 370 |
# File 'lib/roby/interface/client.rb', line 368 def empty? @calls.empty? end |
#kill_job(job_id) ⇒ 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.
Kill the given job within the batch
Note that as all batch operations, order does NOT matter
405 406 407 |
# File 'lib/roby/interface/client.rb', line 405 def kill_job(job_id) __push([], :kill_job, job_id) end |
#respond_to_missing?(m, include_private) ⇒ Boolean
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.
409 410 411 |
# File 'lib/roby/interface/client.rb', line 409 def respond_to_missing?(m, include_private) (m =~ /(.*)!$/) || super end |
#start_job(action_name, *args) ⇒ 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.
Start the given job within the batch
Note that as all batch operations, order does NOT matter
387 388 389 390 391 392 393 |
# 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 |