Repository navigation
Conversation
|
@znz Thank you but, |
Numeric#round passes all of its arguments to Float#round (numeric.c: num_round calls flo_round(argc, argv, rb_Float(num))), so it accepts the half: keyword as well. Use the round_mode alias that Integer#round already uses. The rdoc call-seq on ruby/ruby master is round(digits = 0, half: :up) (96311d13c2), but the generated comment follows the Ruby release used by the RBS Comments workflow, which does not have that fix yet, so the comment is left as generated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Thank you for the review. I looked at what the RBS Comments job actually rewrites: the only diff is the call-seq comment line that I had edited by hand ( I have dropped the hand edit and left the comment as generated; the signature and the test are unchanged. The comment can follow once a Ruby release used by the workflow carries that doc fix. The signature itself holds for 4.0.x: 🤖 Generated with Claude Code |
6102342 to
91b8173
Compare
Changes
Numeric#roundis declared as() -> Integer | (Integer digits) -> Numeric, but it also accepts thehalf:keyword: numeric.c'snum_roundjust callsflo_round(argc, argv, rb_Float(num)), so every argument is forwarded toFloat#round, and the current rdoc call-seq isround(digits = 0, half: :up) -> integer or float.core/numeric.rbs: add?half: round_modeto both overloads ofNumeric#round(theround_modealias is the oneInteger#roundalready uses) and update the generated call-seq comment.test/stdlib/Numeric_test.rb: addtest_roundusing aNumericsubclass that definesto_f, so the test exercisesNumeric#rounditself rather thanInteger#round.Measured on Ruby 4.0.7 with
class N < Numeric; def to_f; 2.5; end; end:Verification
bin/test_runner.rb test/stdlib/Numeric_test.rbandrbs validatepass locally on Ruby 3.4.8.🤖 Generated with Claude Code