Class: PipeRpc::ClientWrapper

Inherits:
BasicInterface show all
Defined in:
lib/pipe_rpc/client_wrapper.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicInterface

add_instance_eval, const_missing, instance_eval_for, remove_instance_eval

Constructor Details

#initialize(gateway, client) ⇒ ClientWrapper

Returns a new instance of ClientWrapper.



5
6
7
8
# File 'lib/pipe_rpc/client_wrapper.rb', line 5

def initialize(gateway, client)
  @client = client
  @gateway = gateway
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



15
16
17
# File 'lib/pipe_rpc/client_wrapper.rb', line 15

def method_missing(method, *args)
  @client.__send__(method, *args)
end

Class Method Details

.from_rpc_transport(gateway, client) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/pipe_rpc/client_wrapper.rb', line 21

def from_rpc_transport(gateway, client)
  if gateway.client_wrapper_class_namespace.const_defined?(client.__rpc_server_class_name__, false)
    gateway.client_wrapper_class_namespace.const_get(client.__rpc_server_class_name__, false).new(gateway, client)
  else
    client
  end
end

Instance Method Details

#inspectObject Also known as: to_s



10
11
12
# File 'lib/pipe_rpc/client_wrapper.rb', line 10

def inspect
  __rpc_server_id__
end