Class: EMStatsd::TCPWrapper
- Inherits:
-
Object
- Object
- EMStatsd::TCPWrapper
- Defined in:
- lib/event_machine/em_statsd/tcp_wrapper.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #close ⇒ Object
- #flush ⇒ Object
-
#initialize(host, port) ⇒ TCPWrapper
constructor
A new instance of TCPWrapper.
- #write(message) ⇒ Object
Constructor Details
#initialize(host, port) ⇒ TCPWrapper
Returns a new instance of TCPWrapper.
6 7 8 9 10 11 |
# File 'lib/event_machine/em_statsd/tcp_wrapper.rb', line 6 def initialize(host, port) # eventmachine forces us to listen on a UDP socket even # though we only # want to send, so we'll just give it a junk address @connection = EM.connect(host, port, EM::Connection) end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
4 5 6 |
# File 'lib/event_machine/em_statsd/tcp_wrapper.rb', line 4 def connection @connection end |
Instance Method Details
#close ⇒ Object
13 14 15 |
# File 'lib/event_machine/em_statsd/tcp_wrapper.rb', line 13 def close connection.close_connection_after_writing end |
#flush ⇒ Object
17 18 19 |
# File 'lib/event_machine/em_statsd/tcp_wrapper.rb', line 17 def flush end |
#write(message) ⇒ Object
21 22 23 |
# File 'lib/event_machine/em_statsd/tcp_wrapper.rb', line 21 def write() connection.send_data() end |