Class: QRPC::Client
- Inherits:
-
Object
- Object
- QRPC::Client
- Defined in:
- lib/qrpc/client.rb,
lib/qrpc/client/job.rb,
lib/qrpc/client/exception.rb,
lib/qrpc/client/dispatcher.rb
Overview
Note:
Since 0.3.0, all non-system methods was moved to the Dispatcher module for maximal avoiding the user API name conflicts.
Queue RPC client.
Defined Under Namespace
Classes: Dispatcher, Exception, Job
Instance Attribute Summary collapse
-
#dispatcher ⇒ Dispatcher
Holds working dispatcher.
Instance Method Summary collapse
-
#initialize(locator) ⇒ Client
constructor
Constructor.
-
#method_missing(name, *args, &block) ⇒ Object
Handles call to RPC.
Constructor Details
#initialize(locator) ⇒ Client
Constructor.
36 37 38 |
# File 'lib/qrpc/client.rb', line 36 def initialize(locator) @dispatcher = QRPC::Client::Dispatcher::new(locator) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
Handles call to RPC. (*********)
Be warn, arguments will be serialized to JSON, so they should be serializable nativelly or implement #to_json
method.
51 52 53 |
# File 'lib/qrpc/client.rb', line 51 def method_missing(name, *args, &block) @dispatcher.put(@dispatcher.create_job(name, args, &block)) end |
Instance Attribute Details
#dispatcher ⇒ Dispatcher
Holds working dispatcher.
28 29 30 |
# File 'lib/qrpc/client.rb', line 28 def dispatcher @dispatcher end |