-
Notifications
You must be signed in to change notification settings - Fork 111
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
Enable parsing of Time Args with 10 parameters #2411
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TODO: It appears the Ten args variant and the 1..=8 variants both support the same parsing of dynamic arguments (e.g. mon supporting "feb"). This is just a stop gap to ten args support, however this code is expected to change somewhat to avoid duplication.
The previous structure relied on always casting to a i64, which is not always the case (see parsing of month, and seconds). This comes at the added cost of always parsing all arguments, however that ends up being a reality in the likes of `Time::utc` etc.
b-n
force-pushed
the
b-n/time-ten-args
branch
from
February 9, 2023 05:58
e971db3
to
6a6827c
Compare
b-n
added
A-ruby-core
Area: Ruby Core types.
C-enhancement
Category: New feature or request.
C-quality
Category: Refactoring, cleanup, and quality improvements.
B-mruby
Backend: Implementation of artichoke-core using mruby.
labels
Feb 9, 2023
b-n
commented
Feb 9, 2023
lopopolo
requested changes
Feb 16, 2023
Co-authored-by: Ryan Lopopolo <rjl@hyperbo.la>
`to_int` should gaurnatee a conversion is possible to an i64. Co-authored-by: Ryan Lopopolo <rjl@hyperbo.la>
b-n
force-pushed
the
b-n/time-ten-args
branch
from
February 17, 2023 11:32
f8bb154
to
43a062a
Compare
lopopolo
approved these changes
Feb 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lookgs good to me!
This was referenced Feb 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-ruby-core
Area: Ruby Core types.
B-mruby
Backend: Implementation of artichoke-core using mruby.
C-enhancement
Category: New feature or request.
C-quality
Category: Refactoring, cleanup, and quality improvements.
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.
Quick follow on from #2410
Adds ten argument support (e.g.
Time.local(*Time.now.to_a)
)Refactor the existing logic to do all type and range checking within the initial parsing. (See the commit details for some more info).
This solves a bunch of problems I had in my head about how to structure this code. It might be somewhat reusable for the likes of
Time::new
, but will have to see.Related to: #2223