Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions string.c
Original file line number Diff line number Diff line change
Expand Up @@ -4551,22 +4551,29 @@ rb_str_cmp(VALUE str1, VALUE str2)

/*
* call-seq:
* string == object -> true or false
* string === object -> true or false
* self == object -> true or false
*
* Returns +true+ if +object+ has the same length and content;
* as +self+; +false+ otherwise:
* Returns whether +object+ is equal to +self+.
*
* When +object+ is a string, returns whether +object+ has the same length and content as +self+:
*
* s = 'foo'
* s == 'foo' # => true
* s == 'foo' # => true
* s == 'food' # => false
* s == 'FOO' # => false
* s == 'FOO' # => false
*
* Returns +false+ if the two strings' encodings are not compatible:
*
* "\u{e4 f6 fc}".encode(Encoding::ISO_8859_1) == ("\u{c4 d6 dc}") # => false
*
* If +object+ is not an instance of +String+ but responds to +to_str+, then the
* two strings are compared using <code>object.==</code>.
* When +object+ is not a string:
*
* - If +object+ responds to method <tt>to_str</tt>,
* <tt>object == self</tt> is called and its return value is returned.
* - If +object+ does not respond to <tt>to_str</tt>,
* +false+ is returned.
*
* Related: {Comparing}[rdoc-ref:String@Comparing].
*/

VALUE
Expand Down