File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -4551,22 +4551,29 @@ rb_str_cmp(VALUE str1, VALUE str2)
45514551
45524552/*
45534553 * call-seq:
4554- * string == object -> true or false
4555- * string === object -> true or false
4554+ * self == object -> true or false
45564555 *
4557- * Returns +true+ if +object+ has the same length and content;
4558- * as +self+; +false+ otherwise:
4556+ * Returns whether +object+ is equal to +self+.
4557+ *
4558+ * When +object+ is a string, returns whether +object+ has the same length and content as +self+:
45594559 *
45604560 * s = 'foo'
4561- * s == 'foo' # => true
4561+ * s == 'foo' # => true
45624562 * s == 'food' # => false
4563- * s == 'FOO' # => false
4563+ * s == 'FOO' # => false
45644564 *
45654565 * Returns +false+ if the two strings' encodings are not compatible:
4566+ *
45664567 * "\u{e4 f6 fc}".encode(Encoding::ISO_8859_1) == ("\u{c4 d6 dc}") # => false
45674568 *
4568- * If +object+ is not an instance of +String+ but responds to +to_str+, then the
4569- * two strings are compared using <code>object.==</code>.
4569+ * When +object+ is not a string:
4570+ *
4571+ * - If +object+ responds to method <tt>to_str</tt>,
4572+ * <tt>object == self</tt> is called and its return value is returned.
4573+ * - If +object+ does not respond to <tt>to_str</tt>,
4574+ * +false+ is returned.
4575+ *
4576+ * Related: {Comparing}[rdoc-ref:String@Comparing].
45704577 */
45714578
45724579VALUE
You can’t perform that action at this time.
0 commit comments