lib/nunes/adapter.rb in nunes-0.4.0 vs lib/nunes/adapter.rb in nunes-0.5.0
- old
+ new
@@ -1,5 +1,7 @@
+require 'active_support/core_ext/class/subclasses'
+
module Nunes
class Adapter
# Private: Wraps a given object with the correct adapter/decorator.
#
# client - The thing to be wrapped.
@@ -53,13 +55,13 @@
# Private: What Ruby uses to separate namespaces.
ReplaceRegex = /[^a-z0-9\-_]+/i
# Private: The default metric namespace separator.
- Separator = "."
+ Separator = ".".freeze
# Private
- Nothing = ""
+ Nothing = "".freeze
# Private: Prepare a metric name before it is sent to the adapter's client.
def prepare(metric, replacement = Separator)
escaped = Regexp.escape(replacement)
replace_begin_end_regex = /\A#{escaped}|#{escaped}\Z/