Class: Dcmgr::MessagingClient::RpcSyncDelegator

Inherits:
Object
  • Object
show all
Defined in:
lib/dcmgr/messaging_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rpc, endpoint, opts = {}) ⇒ RpcSyncDelegator

Returns a new instance of RpcSyncDelegator.



72
73
74
75
76
# File 'lib/dcmgr/messaging_client.rb', line 72

def initialize(rpc, endpoint, opts={})
  @rpc = rpc
  @endpoint = endpoint
  @opts = {:timeout=>0.0, :oneshot=>false}.merge(opts)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object (private)



79
80
81
82
83
84
85
# File 'lib/dcmgr/messaging_client.rb', line 79

def method_missing(m, *args)
  if @opts[:oneshot]
    oneshot_request(m, *args)
  else
    normal_request(m, *args)
  end
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



70
71
72
# File 'lib/dcmgr/messaging_client.rb', line 70

def endpoint
  @endpoint
end