class Fluent::Counter::Connection
Public Class Methods
new(io, on_message)
click to toggle source
Calls superclass method
# File lib/fluent/counter/client.rb, line 199 def initialize(io, on_message) super(io) @connection = false @buffer = '' @on_message = on_message end
Public Instance Methods
on_close()
click to toggle source
# File lib/fluent/counter/client.rb, line 220 def on_close @connection = false end
on_connect()
click to toggle source
# File lib/fluent/counter/client.rb, line 214 def on_connect @connection = true write @buffer @buffer = '' end
on_message(data)
click to toggle source
# File lib/fluent/counter/client.rb, line 224 def on_message(data) @on_message.call(data) end
send_data(data)
click to toggle source
# File lib/fluent/counter/client.rb, line 206 def send_data(data) if @connection packed_write data else @buffer += pack(data) end end