Class: Grid::ZMQ::Stdin
Instance Method Summary collapse
-
#initialize ⇒ Stdin
constructor
A new instance of Stdin.
- #listen(address) ⇒ Object
Methods inherited from Socket
Constructor Details
#initialize ⇒ Stdin
Returns a new instance of Stdin.
8 9 10 11 12 |
# File 'lib/grid/zmq/stdin.rb', line 8 def initialize super(::ZMQ::SUB) send(:setsockopt, ::ZMQ::SUBSCRIBE, '') end |
Instance Method Details
#listen(address) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/grid/zmq/stdin.rb', line 14 def listen(address) send(:connect, address) loop do send(:recv_string, body = '') yield Command.parse(body) end end |