Permalink
Browse files

Refactor out crazy long line

  • Loading branch information...
jstorimer committed Jan 25, 2013
1 parent 264c69f commit 3e03ade2ebe322a50a48361e6c28f75e9182a549
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/statsd/instrument.rb
View
@@ -47,7 +47,10 @@ def statsd_count_success(method, name, sample_rate = StatsD.default_sample_rate)
truthiness = (yield(result) rescue false) if block_given?
result
ensure
- StatsD.increment("#{metric_name.respond_to?(:call) ? metric_name.call(self, args) : metric_name}." + (truthiness == false ? 'failure' : 'success'), sample_rate)
+ result = truthiness == false ? 'failure' : 'success'
+ key = metric_name.respond_to?(:call) ? metric_name.call(self, args) : metric_name
+
+ StatsD.increment("#{key}.#{result}", sample_rate)
end
end
end

0 comments on commit 3e03ade

Please sign in to comment.