Open mheffner opened 10 years ago
Hmm, to clarify you are asking that the hash-accessor keys be case-insensitive?
@nextmat Correct, so that the following would work:
{"blah" => <...>}["bLaH"]
@mheffner The only real way to do this consistently is rewrite all the of the responses from native types to something that wraps them for case-insensitive access. For small payloads this is no big deal but in larger cases it could be a memory/perf issue.
After pondering a bit I'm of the opinion that if this is something people want they should do it after they get the results from this lib, via something like HashWithIndifferentAccess or map.
If possible, it would be nice to treat the key strings in the fetch response as case insensitive.
The following query will return data for the source "bLaH", but given the API downcases the source names, the hash lookup would then break:
Librato::Metrics.fetch(metric_name, :count => count, :source => "bLaH")["bLaH"]
Maybe a Hash override that downcased key values before lookup?