ruby-changes:71172
From: Koichi <ko1@a...>
Date: Sun, 13 Feb 2022 15:48:17 +0900 (JST)
Subject: [ruby-changes:71172] 045ab1d056 (master): [DOC] Fix a typo in `Integer#chr` example
https://git.ruby-lang.org/ruby.git/commit/?id=045ab1d056 From 045ab1d056e3babcb02e92f6d7e6426a936f2ca3 Mon Sep 17 00:00:00 2001 From: Koichi ITO <koic.ito@g...> Date: Sun, 13 Feb 2022 12:17:18 +0900 Subject: [DOC] Fix a typo in `Integer#chr` example The current example raises the following error. ```ruby 0..chr # => undefined local variable or method `chr' for main:Object (NameError) ``` This PR updates the example to produce the expected behavior. ```ruby 0.chr # => "\x00" ``` --- numeric.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/numeric.c b/numeric.c index 61f93c4f01..0e33c0f4ba 100644 --- a/numeric.c +++ b/numeric.c @@ -3775,7 +3775,7 @@ rb_enc_uint_chr(unsigned int code, rb_encoding *enc) https://github.com/ruby/ruby/blob/trunk/numeric.c#L3775 * represented by the value of +self+, according to the given +encoding+. * * 65.chr # => "A" - * 0..chr # => "\x00" + * 0.chr # => "\x00" * 255.chr # => "\xFF" * string = 255.chr(Encoding::UTF_8) * string.encoding # => Encoding::UTF_8 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/