diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | string.c | 8 |
2 files changed, 10 insertions, 3 deletions
@@ -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. @@ -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); } /* |