Module: Equity::SocketPairing

Defined in:
lib/equity/socket_pairing.rb

Overview

Enables pairing of sockets, so a client socket can be linked to a server socket.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#mateObject (readonly)

Returns the value of attribute mate.



5
6
7
# File 'lib/equity/socket_pairing.rb', line 5

def mate
  @mate
end

Instance Method Details

#pair_with(other_socket, one_way = false) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/equity/socket_pairing.rb', line 7

def pair_with(other_socket, one_way = false)
  @mate = other_socket
  unless one_way
    other_socket.extend SocketPairing
    other_socket.pair_with(self, true)
  end
end