Class: Syslog::Server
- Inherits:
-
Object
- Object
- Syslog::Server
- Defined in:
- lib/syslog/server.rb
Constant Summary collapse
- VERSION =
'1.0.1'
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(transport) ⇒ Server
constructor
A new instance of Server.
- #stop ⇒ Object
- #stopped? ⇒ Boolean
Constructor Details
#initialize(transport) ⇒ Server
Returns a new instance of Server.
12 13 14 15 16 17 18 19 20 |
# 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 |
Class Method Details
Instance Method Details
#stop ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/syslog/server.rb', line 22 def stop unless @thread.nil? @thread.kill @thread.join @thread = nil end end |
#stopped? ⇒ Boolean
30 31 32 |
# File 'lib/syslog/server.rb', line 30 def stopped? @thread.nil? end |