Class: Measures::Client
- Inherits:
-
Object
- Object
- Measures::Client
- Defined in:
- lib/measures/client.rb
Instance Method Summary collapse
- #count(metric, data = {}) ⇒ Object
-
#initialize(client, host, port) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(client, host, port) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 |
# File 'lib/measures/client.rb', line 6 def initialize(client, host, port) @client = client @socket = UDPSocket.new @socket.connect(host, port) end |
Instance Method Details
#count(metric, data = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/measures/client.rb', line 12 def count(metric, data = {}) = { "client" => @client, "metric" => metric, "count" => 1, } data = data.merge() @socket.send(data.to_json, 0) end |