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.
Defined
Kernel#sleep
in more detail.Fix some problems
1.
Complex
inherits fromNumeric
, but does not accept.2. Any object that does not inherit from Numeric can be passed as an argument, as long as
#divmod
is defined.https://github.com/ruby/spec/blob/1a68f6e0ffede9f0c2c6eb8c6dff75924df79d91/core/kernel/sleep_spec.rb#L25-L29
More detail
Since
#divmod
is defined for bothInteger
andFloat
, it could be just(_Divmod duration) -> Integer
, but there are some surprises in the documentation, and I used(Integer | Float | _Divmod)
in reference to CRuby implementation.CRuby implementation is
time_timespec
function in time.c.https://github.com/ruby/ruby/blob/af107710457b4bd148c6e5ee7a336ed4961f5423/time.c#L2560-L2609
There is a method
File.utime
that usestime_timespec
function, but its behavior is not described in ruby/spec, and I've narrowed down the scope to sleep.