mirror of
https://github.com/jimeh/redistat.git
synced 2026-02-19 05:16:39 +00:00
Improve Buffer's unique key identifier
This commit is contained in:
@@ -95,12 +95,15 @@ module Redistat
|
||||
end
|
||||
end
|
||||
|
||||
# depth_limit is not needed as it's evident in key.to_s
|
||||
def buffer_key(key, opts)
|
||||
# depth_limit is not needed as it's evident in key.to_s
|
||||
opts_index = Summary.default_options.keys.sort { |a,b| a.to_s <=> b.to_s }.map do |k|
|
||||
opts[k] if opts.has_key?(k)
|
||||
# covert keys to strings, as sorting a Hash with Symbol keys fails on
|
||||
# Ruby 1.8.x.
|
||||
opts = opts.inject({}) do |result, (k, v)|
|
||||
result[k.to_s] = v
|
||||
result
|
||||
end
|
||||
"#{key.to_s}:#{opts_index.join(':')}"
|
||||
"#{key.to_s}:#{opts.sort.flatten.join(':')}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user