Skip to content

Commit

Permalink
[DOC] Fix a typo in Integer#chr example
Browse files Browse the repository at this point in the history
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"
```
  • Loading branch information
koic authored and hsbt committed Feb 13, 2022
1 parent 11862c1 commit 045ab1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion numeric.c
Expand Up @@ -3775,7 +3775,7 @@ rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
* 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
Expand Down

0 comments on commit 045ab1d

Please sign in to comment.