Class: EMRPC::Client

Inherits:
BlankSlate
  • Object
show all
Defined in:
lib/emrpc/client.rb

Defined Under Namespace

Classes: BlockingPid

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, options = {}) ⇒ Client

Single argument can be one of the following:

  • Address of pid to connect to (e.g. “emrpc://localhost:4000/”)

  • Pid to connect to. Use this instead of address to pass some pid for in-process communication.

You can also pass optional params for EMRPC::ReconnectingPid.



10
11
12
13
# File 'lib/emrpc/client.rb', line 10

def initialize(address, options = {})
  @address = address
  @pid = BlockingPid.new(@address, options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &blk) ⇒ Object



15
16
17
# File 'lib/emrpc/client.rb', line 15

def method_missing(meth, *args, &blk)
  @pid.blocking_send(meth, *args)
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



3
4
5
# File 'lib/emrpc/client.rb', line 3

def address
  @address
end

Instance Method Details

#kill_pidObject



19
20
21
# File 'lib/emrpc/client.rb', line 19

def kill_pid
  @pid.kill
end