Class: MaZMQ::Reply
- Inherits:
-
SocketHandler
- Object
- SocketHandler
- MaZMQ::Reply
- Defined in:
- lib/ma-zmq/reply.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#initialize ⇒ Reply
constructor
A new instance of Reply.
- #recv_string ⇒ Object
- #send_string(msg) ⇒ Object
Methods inherited from SocketHandler
#addresses, #bind, #close, #connect, #identity, #identity=, #on_read, #on_write, #socket_type
Constructor Details
#initialize ⇒ Reply
Returns a new instance of Reply.
5 6 7 8 |
# File 'lib/ma-zmq/reply.rb', line 5 def initialize @socket_type = ZMQ::REP super end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
3 4 5 |
# File 'lib/ma-zmq/reply.rb', line 3 def state @state end |
Instance Method Details
#recv_string ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# 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) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# 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 |