Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate the data before initializing config to fail fast #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danialm
Copy link

@danialm danialm commented Nov 10, 2023

Config relies on keys being string or symbol (it passes them to Regex#match) but does not validate the input on initialization. So you can initialize it with { { foo: :bar } => :baz, foo: :baz } and you only get an error while trying to get(:foo).

I was not able to validate the input in any other reliable way. Things like data.keys.all? Symbole || data.keys.all? String or data.keys.all? { |k| k.instance_of?(Symbole) || k.instance_of?(String) } did not work

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

Successfully merging this pull request may close these issues.

1 participant