Permalink
Browse files

setting host should clear out the ip addr

  • Loading branch information...
1 parent 8a415e8 commit d1ac4ca7f510634d324f33d50ea04dda33fa5b0a @bvandenbos bvandenbos committed Apr 21, 2011
Showing with 11 additions and 0 deletions.
  1. +5 −0 lib/statsd.rb
  2. +6 −0 test/statsd_test.rb
View
@@ -15,6 +15,11 @@ def host_ip_addr
end
end
+ def host=(h)
+ @host_ip_addr = nil
+ @host = h
+ end
+
# +stat+ to log timing for
# +time+ is the time to log in ms
def timing(stat, time, sample_rate = 1)
View
@@ -96,6 +96,12 @@ def setup
assert_equal '127.0.0.1', Statsd.host_ip_addr
end
+ should "be cleared when host is set" do
+ assert_equal '127.0.0.1', Statsd.host_ip_addr
+ Statsd.host = 'statsd-01'
+ assert_nil Statsd.instance_variable_get(:@host_ip_addr)
+ end
+
end
private

0 comments on commit d1ac4ca

Please sign in to comment.