Skip to content

validate the data before initializing config to fail fast#11

Open
danialm wants to merge 1 commit intocareo:masterfrom
danialm:master
Open

validate the data before initializing config to fail fast#11
danialm wants to merge 1 commit intocareo:masterfrom
danialm:master

Conversation

@danialm
Copy link
Copy Markdown

@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