Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor Statsd#timing and #count to use #send

  • Loading branch information...
commit a480d980a575287176fc8fd8213b88712eb75eb5 1 parent 8ef437e
Rein Henrichs authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/statsd.rb
View
8 lib/statsd.rb
@@ -13,15 +13,19 @@ def decrement(stat)
end
def count(stat, count)
- socket.send("#{stat}:#{count}|c")
+ send(stat, count, 'c')
end
def timing(stat, ms)
- socket.send("#{stat}:#{ms}|ms")
+ send(stat, ms, 'ms')
end
private
+ def send(stat, delta, type)
+ socket.send("#{stat}:#{delta}|#{type}")
+ end
+
def socket
@socket ||= UDPSocket.new(host, post)
end
Please sign in to comment.
Something went wrong with that request. Please try again.