summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--string.c8
2 files changed, 10 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 67623aa8e0..0ce7d50223 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Sep 11 07:39:44 2006 Yukihiro Matsumoto <[email protected]>
+
+ * string.c (sym_equal): "sym == str" should compare them as
+ strings. [ruby-dev:29554]
+
Sun Sep 10 22:59:43 2006 Nobuyoshi Nakada <[email protected]>
* instruby.rb (parse_args): remove splat.
diff --git a/string.c b/string.c
index dc389b16fb..094907fe54 100644
--- a/string.c
+++ b/string.c
@@ -120,6 +120,7 @@ str_alloc(VALUE klass)
OBJSETUP(str, klass, T_STRING);
if (klass == rb_cSymbol) {
+ /* need to be registered in table */
RBASIC(str)->klass = rb_cString;
}
str->as.heap.ptr = 0;
@@ -4429,15 +4430,16 @@ rb_sym_s_intern(VALUE s)
* sym == obj => true or false
*
* Equality---If <i>sym</i> and <i>obj</i> are exactly the same
- * symbol, returns <code>true</code>. Otherwise, returns
- * <code>false</code>.
+ * symbol, returns <code>true</code>. Otherwise, compares them
+ * as strings.
*/
static VALUE
sym_equal(VALUE sym1, VALUE sym2)
{
if (sym1 == sym2) return Qtrue;
- return Qfalse;
+ if (SYMBOL_P(sym2)) return Qfalse;
+ return rb_str_equal(sym1, sym2);
}
/*