Class: Droonga::FluentMessageReceiver::Client
- Inherits:
-
Object
- Object
- Droonga::FluentMessageReceiver::Client
- Includes:
- Loggable
- Defined in:
- lib/droonga/fluent_message_receiver.rb
Instance Attribute Summary collapse
-
#on_close ⇒ Object
Returns the value of attribute on_close.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(io, &on_message) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(io, &on_message) ⇒ Client
Returns a new instance of Client.
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/droonga/fluent_message_receiver.rb', line 217 def initialize(io, &) @io = io @on_message = @on_close = nil @unpacker = MessagePack::Unpacker.new @io.on_read do |data| feed(data) end @io.on_close do @io = nil @on_close.call if @on_close end end |
Instance Attribute Details
#on_close ⇒ Object
Returns the value of attribute on_close.
216 217 218 |
# File 'lib/droonga/fluent_message_receiver.rb', line 216 def on_close @on_close end |
Instance Method Details
#close ⇒ Object
233 234 235 |
# File 'lib/droonga/fluent_message_receiver.rb', line 233 def close @io.close end |