class Zlogger::Reader
Attributes
options[R]
Public Class Methods
new(options={})
click to toggle source
# File lib/zlogger/reader.rb, line 7 def initialize(options={}) @options = options end
Public Instance Methods
address()
click to toggle source
# File lib/zlogger/reader.rb, line 29 def address options[:address] ||= "0.0.0.0" end
context()
click to toggle source
# File lib/zlogger/reader.rb, line 21 def context @context ||= (ZMQ.context || ZMQ::Context.new) end
port()
click to toggle source
# File lib/zlogger/reader.rb, line 25 def port options[:port] ||= DEFAULT_PORT + 1 end
run()
click to toggle source
# File lib/zlogger/reader.rb, line 33 def run begin loop do puts sub_socket.recv end rescue Interrupt # exit nicely end end
sub_socket()
click to toggle source
# File lib/zlogger/reader.rb, line 11 def sub_socket @sub_socket ||= begin socket = context.socket :SUB socket.subscribe "" socket.connect("tcp://#{address}:#{port}") socket end end