Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Fetch response is case insensitive #95

Open
mheffner opened this issue May 9, 2014 · 3 comments
Open

Fetch response is case insensitive #95

mheffner opened this issue May 9, 2014 · 3 comments

Comments

@mheffner
Copy link
Contributor

mheffner commented May 9, 2014

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?

@nextmat
Copy link
Contributor

nextmat commented May 9, 2014

Hmm, to clarify you are asking that the hash-accessor keys be case-insensitive?

@mheffner
Copy link
Contributor Author

mheffner commented May 9, 2014

@nextmat Correct, so that the following would work:

{"blah" => <...>}["bLaH"]

@nextmat
Copy link
Contributor

nextmat commented Nov 5, 2014

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants