Silence parser warning and patch version mismatch when loading parser/current #613
+33
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request adds a factory class
RubyParserFactory
to temporarily disable verbose mode when loading the "parser/current" library. The purpose is to suppress compatibility warnings that are displayed when the library is loaded with a different Ruby version than the one it recognizes.Example warning for the release of Ruby 3.4.1 :
By disabling verbose mode, these warnings are suppressed to provide a cleaner output and avoid confusion. The verbose mode is restored after the parser instance is created to maintain the original behavior.
References
Changes
I18n::Tasks::Scanners
to encapsulate the factory class.RubyParserFactory
class with acreate_parser
method that temporarily disables verbose mode, loads the "parser/current" library, creates a new parser instance, and restores the verbose mode.Benefits
Issues
Please let me know if you have any questions or feedback regarding this pull request.
Thank you for considering this contribution to the gem!