Class: PipeRpc::Client
- Inherits:
-
BasicInterface
- Object
- BasicInterface
- PipeRpc::Client
- Defined in:
- lib/pipe_rpc/client.rb
Defined Under Namespace
Classes: Request
Constant Summary collapse
- TRANSPORT_PREFIX =
"__rpc_client__"
Instance Attribute Summary collapse
-
#__rpc_server_class_name__ ⇒ Object
readonly
Returns the value of attribute rpc_server_class_name.
-
#__rpc_server_id__ ⇒ Object
readonly
Returns the value of attribute rpc_server_id.
Instance Method Summary collapse
-
#initialize(server_id = :default, hub) ⇒ Client
constructor
A new instance of Client.
- #method_missing(method, *args) ⇒ Object
- #respond_to?(method) ⇒ Boolean
- #to_rpc_transport(hub = nil) ⇒ Object
Methods inherited from BasicInterface
Constructor Details
#initialize(server_id = :default, hub) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 |
# File 'lib/pipe_rpc/client.rb', line 5 def initialize(server_id = :default, hub) Kernel.raise ClientInitializationError.new("server id #{server_id.inspect} no symbol") unless server_id.is_a? Symbol @__rpc_server_id__ = server_id @__rpc_server_class_name__ = server_id.to_s.split('#').first @hub = hub end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#__rpc_server_class_name__ ⇒ Object (readonly)
Returns the value of attribute rpc_server_class_name.
12 13 14 |
# File 'lib/pipe_rpc/client.rb', line 12 def __rpc_server_class_name__ @__rpc_server_class_name__ end |
#__rpc_server_id__ ⇒ Object (readonly)
Returns the value of attribute rpc_server_id.
12 13 14 |
# File 'lib/pipe_rpc/client.rb', line 12 def __rpc_server_id__ @__rpc_server_id__ end |
Instance Method Details
#respond_to?(method) ⇒ Boolean
14 15 16 |
# File 'lib/pipe_rpc/client.rb', line 14 def respond_to?(method) super or method_missing(:respond_to?, method) end |
#to_rpc_transport(hub = nil) ⇒ Object
23 24 25 |
# File 'lib/pipe_rpc/client.rb', line 23 def to_rpc_transport(hub = nil) "#{TRANSPORT_PREFIX}#{@__rpc_server_id__}" end |