Skip to content

URI::GID: Update #check_scheme, no need to call super#146

Merged
rafaelfranca merged 1 commit intorails:mainfrom
alexcwatt:update-check_scheme
Aug 5, 2022
Merged

URI::GID: Update #check_scheme, no need to call super#146
rafaelfranca merged 1 commit intorails:mainfrom
alexcwatt:update-check_scheme

Conversation

@alexcwatt
Copy link
Contributor

When instantiating a GlobalId, the scheme has to be validated with check_scheme. Currently anything other than "gid" is invalid, and then if the string used is exactly "gid" we call super which ends up running some Regex in URI::Generic#check_scheme.

This PR is a small optimization - I don't think we need to call check_scheme, shouldn't "gid" always pass?

Here's the method in URI::Generic: https://github.com/ruby/ruby/blob/1e7a2415a4c69aa64c9c2a561197bf9cfc5a91f8/lib/uri/generic.rb#L320-L324

@rafaelfranca rafaelfranca merged commit 5da6355 into rails:main Aug 5, 2022
@alexcwatt alexcwatt deleted the update-check_scheme branch August 18, 2022 00:26
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.

2 participants