Class: XenApi::AsyncDispatcher
- Inherits:
-
Object
- Object
- XenApi::AsyncDispatcher
- Defined in:
- lib/xenapi/async_dispatcher.rb
Overview
This class helps to provide the ability for the XenApi::Client
to accept async
method calls. Calls are similar to synchronous method calls except that the names are prefixed with ‘Async’.
client = XenApi::Client.new('http://xenapi.test/')
client.async #=> AsyncDispatcher instance
client.async.VM #=> Dispatcher instance for 'Async.VM'
client.async.VM.start() #=> Performs XMLRPC 'Async.VM.start' call
further calls on instances of this object will create a Dispatcher
instance which then handle actual method calls.
Instance Method Summary collapse
-
#initialize(client, sender) ⇒ AsyncDispatcher
constructor
A new instance of AsyncDispatcher.
- #inspect ⇒ Object
-
#method_missing(meth, *args) ⇒ Dispatcher
Create a new
Dispatcher
instance to handle theAsync.meth
prefix.
Constructor Details
#initialize(client, sender) ⇒ AsyncDispatcher
Returns a new instance of AsyncDispatcher.
17 18 19 20 |
# File 'lib/xenapi/async_dispatcher.rb', line 17 def initialize(client, sender) @client = client @sender = sender end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Dispatcher
Create a new Dispatcher
instance to handle the Async.meth
prefix.
32 33 34 |
# File 'lib/xenapi/async_dispatcher.rb', line 32 def method_missing(meth, *args) Dispatcher.new(@client, "Async.#{meth}", @sender) end |
Instance Method Details
#inspect ⇒ Object
23 24 25 |
# File 'lib/xenapi/async_dispatcher.rb', line 23 def inspect "#<#{self.class}>" end |