Project

General

Profile

Actions

Misc #12835

closed

RDoc comment of String#casecmp

Added by dogatana (Toshihiko Ichida) almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Assignee:
-
[ruby-dev:49835]

Description

String#casecmp dose not return nil but raise TypError for incomparable argument.

So

 *     str.casecmp(other_str)   -> -1, 0, +1 or nil

should be like

 *     str.casecmp(other_str)   -> -1, 0, +1

or

 *     str.casecmp(other_str)   -> -1, 0, +1 or raise TypeError if other_str is not comparable

Here is a example.

irb(main):001:0> "a" <=> 1                               
=> nil                                                   
irb(main):002:0> "a".casecmp(1)                          
TypeError: no implicit conversion of Fixnum into String  

Japanese Reference Manual has same issue.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0