mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (sym_equal): "sym == str" should compare them as
strings. [ruby-dev:29554] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f16b5afcac
commit
a36197bd58
2 changed files with 10 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Sep 11 07:39:44 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* string.c (sym_equal): "sym == str" should compare them as
|
||||
strings. [ruby-dev:29554]
|
||||
|
||||
Sun Sep 10 22:59:43 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* instruby.rb (parse_args): remove splat.
|
||||
|
|
8
string.c
8
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue