class Syslog::Server
Constants
- VERSION
Public Class Methods
new(transport) { |read| ... }
click to toggle source
# File lib/syslog/server.rb, line 12 def initialize(transport) @thread = Thread.new do begin loop { yield transport.read } ensure transport.close end end end
transport(name)
click to toggle source
# File lib/syslog/server.rb, line 35 def self.transport(name) define_method(name) do |host_or_port, port = nil, &block| klass = Syslog::Transport.const_get("#{name.to_s.upcase}Transport") Syslog::Server.new(klass.new(host_or_port, port), &block) end end
Public Instance Methods
stop()
click to toggle source
# File lib/syslog/server.rb, line 22 def stop unless @thread.nil? @thread.kill @thread.join @thread = nil end end
stopped?()
click to toggle source
# File lib/syslog/server.rb, line 30 def stopped? @thread.nil? end