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

Simplify Time.find_timezone! logic #41957

Merged
merged 1 commit into from Apr 13, 2021
Merged

Simplify Time.find_timezone! logic #41957

merged 1 commit into from Apr 13, 2021

Conversation

pixeltrix
Copy link
Contributor

By pushing the checks for TZInfo::Timezone and ActiveSupport::TimeZone down into the case statement inside the [] method we can radically simplify the logic inside of the find_timezone! method.

There's an edge case where passing an invalid argument to [] via the find_timezone! method generates a slightly different message for the ArgumentError exception and this is maintained in the unlikely case someone was relying on the difference.

By pushing the checks for TZInfo::Timezone and ActiveSupport::TimeZone
down into the case statement inside the `[]` method we can radically
simplify the logic inside of the `find_timezone!` method.

There's an edge case where passing an invalid argument to `[]` via the
`find_timezone!` method generates a slightly different message for the
`ArgumentError` exception and this is maintained in the unlikely case
someone was relying on the difference.
@pixeltrix pixeltrix merged commit b259fbc into main Apr 13, 2021
@pixeltrix pixeltrix deleted the simplify-find-timezone branch April 13, 2021 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants