class MaZMQ::Reply

Attributes

state[R]

Public Class Methods

new() click to toggle source
Calls superclass method MaZMQ::SocketHandler::new
# File lib/ma-zmq/reply.rb, line 5
def initialize
  @socket_type = ZMQ::REP
  super
end

Public Instance Methods

recv_string() click to toggle source
Calls superclass method MaZMQ::SocketHandler#recv_string
# File lib/ma-zmq/reply.rb, line 10
def recv_string
  case @state
    when :idle
      msg = super
      if msg and not msg.empty?
        @state = :reply
      end
      return msg
    else
      return false
  end
end
send_string(msg) click to toggle source
Calls superclass method MaZMQ::SocketHandler#send_string
# File lib/ma-zmq/reply.rb, line 23
def send_string(msg)
  case @state
    when :reply
      resp = super(msg)
      @state = :idle
      return resp
    else
      return false
  end
end