Skip to content

Check if type: array values are in enum#784

Merged
rafaelfranca merged 1 commit into
rails:mainfrom
movermeyer:movermeyer/add_enum_validation_to_array_values
May 12, 2023
Merged

Check if type: array values are in enum#784
rafaelfranca merged 1 commit into
rails:mainfrom
movermeyer:movermeyer/add_enum_validation_to_array_values

Conversation

@movermeyer

Copy link
Copy Markdown
Contributor

🌈

What are you trying to accomplish?

Fixes #783

What approach did you choose and why?

Extending the pattern done for type: string and type: numeric.

What should reviewers focus on?

🤷

The impact of these changes

enum validation will be done for type: array option values.

array << shift while current_is_value?
while current_is_value?
value = shift
if !value.empty? && @switches.is_a?(Hash) && switch = @switches[name]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we restructure this conditional a bit? The = towards the end is kind of like a shark in calm waters, it's really unexpected.

@rafaelfranca rafaelfranca merged commit 98ebfd2 into rails:main May 12, 2023
movermeyer added a commit to ruby-i18n/ruby-cldr that referenced this pull request Nov 30, 2024
movermeyer added a commit to ruby-i18n/ruby-cldr that referenced this pull request Nov 30, 2024
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.

enum should be enforced for all values of type: array

3 participants