lib/iruby/out_stream.rb
#A file like object that publishes the stream to a 0MQ PUB socket.
A file like object that publishes the stream to a 0MQ PUB socket.
A file like object that publishes the stream to a 0MQ PUB socket .
def flush
      if @pub_socket.nil?
        raise 'I/O operation on closed file'
      else
        if @_buffer
          data = @_buffer.join('')
          content = { name: @name, data: data }
          if ! @session
            return
          end
          @session.send(@pub_socket, 'stream', content, @parent_header)
          @_buffer_len = 0
          @_buffer = []
          nil
        end
      end
    end
def flush if @pub_socket . nil? raise 'I/O operation on closed file' else if @_buffer data = @_buffer . join ( '' ) content = { name : @name , data : data } if ! @session return end @session . send ( @pub_socket , 'stream' , content , @parent_header ) @_buffer_len = 0 @_buffer = [ ] nil end end end
A file like object that publishes the stream to a 0MQ PUB socket.
A file like object that publishes the stream to a 0MQ PUB socket .
# STDERR.puts("flushing, parent to follow") # STDERR.puts @parent_header.inspect # msg = @session.msg('stream', content, @parent_header) if @session # FIXME: Wha? # STDERR.puts msg.to_json #@pub_socket.send(msg.to_json)