8000 Fix Integer#ceildiv to respect #coerce by kyanagi · Pull Request #7118 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

Fix Integer#ceildiv to respect #coerce #7118

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

Merged
merged 1 commit into from
Jan 22, 2023

Conversation

kyanagi
Copy link
Contributor
@kyanagi kyanagi commented Jan 13, 2023

Since Integer#div, Integer#fdiv, etc respect #coerce, so should #ceildiv.

c = Object.new
def c.coerce(other) = [other, 10]

p 1234 / c          # => 123
p 1234.div(c)       # => 123
p 1234.quo(c)       # => (617/5)
p 1234.fdiv(c)      # => 123.4
p 1234.ceildiv(c)   # => in `ceildiv': undefined method `-@' for #<Object:0x000000010250ad68> (NoMethodError)

< 8000 div data-view-component="true" class="TimelineItem-badge">
@nobu nobu requested a review from mrkn January 16, 2023 08:36
@mrkn mrkn merged commit 20a85ab into ruby:master Jan 22, 2023
@kyanagi kyanagi deleted the integer-ceildiv-should-respect-coerce branch November 21, 2023 06:54
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
0