Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 116c12e

Browse files
author
Vicent Marti
committed
Add optional ports
1 parent affe1b9 commit 116c12e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/statsd.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ def initialize(host, port=8125, key=nil)
4848
add_host(host, port, key)
4949
end
5050

51-
def add_host(host, port, key = nil)
52-
@hosts << Host.new(host, port, key)
51+
def add_host(host, port = nil, key = nil)
52+
host, port = host.split(':') if host.include?(':')
53+
@hosts << Host.new(host, port.to_i, key)
5354
end
5455

5556
# Sends an increment (count = 1) for the given stat to the statsd server.

0 commit comments

Comments
 (0)