* hash.c (rb_hash_compare_by_identity): rename Hash#identical to
Hash#compare_by_identity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ad0b87727d
commit
026f734f4c
11
.cvsignore
11
.cvsignore
@ -8,6 +8,7 @@
|
|||||||
.ext
|
.ext
|
||||||
.git
|
.git
|
||||||
.svn
|
.svn
|
||||||
|
.pc
|
||||||
.rbconfig.time
|
.rbconfig.time
|
||||||
COPYING.LIB
|
COPYING.LIB
|
||||||
ChangeLog.pre-alpha
|
ChangeLog.pre-alpha
|
||||||
@ -29,15 +30,10 @@ config.status
|
|||||||
configure
|
configure
|
||||||
libruby.so.*
|
libruby.so.*
|
||||||
miniruby
|
miniruby
|
||||||
miniruby.elhash
|
|
||||||
miniruby.elhash2
|
|
||||||
miniruby.orig2
|
|
||||||
miniruby.plhash
|
|
||||||
miniruby.plhash2
|
|
||||||
newdate.rb
|
newdate.rb
|
||||||
newver.rb
|
newver.rb
|
||||||
parse.c
|
parse.c
|
||||||
parse.y.try
|
patches
|
||||||
pitest.rb
|
pitest.rb
|
||||||
ppack
|
ppack
|
||||||
preview
|
preview
|
||||||
@ -48,9 +44,6 @@ riscos
|
|||||||
rubicon
|
rubicon
|
||||||
ruby
|
ruby
|
||||||
ruby-man.rd.gz
|
ruby-man.rd.gz
|
||||||
rubyunit
|
|
||||||
st.c.power
|
|
||||||
this that
|
|
||||||
tmp
|
tmp
|
||||||
web
|
web
|
||||||
y.output
|
y.output
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
Tue Sep 12 03:58:39 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* hash.c (rb_hash_compare_by_identity): rename Hash#identical to
|
||||||
|
Hash#compare_by_identity.
|
||||||
|
|
||||||
Mon Sep 11 16:52:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Sep 11 16:52:37 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* hash.c (rb_hash_identical): a new method to make a hash to
|
* hash.c (rb_hash_identical): a new method to make a hash to
|
||||||
|
18
hash.c
18
hash.c
@ -1482,22 +1482,22 @@ static struct st_hash_type identhash = {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* hsh.identical => hsh
|
* hsh.compare_by_identity => hsh
|
||||||
*
|
*
|
||||||
* Makes <i>hsh</i> to compare its keys by their identity, i.e. it
|
* Makes <i>hsh</i> to compare its keys by their identity, i.e. it
|
||||||
* will consider exact same objects as same keys.
|
* will consider exact same objects as same keys.
|
||||||
*
|
*
|
||||||
* h1 = { "a" => 100, "b" => 200, :c => "c" }
|
* h1 = { "a" => 100, "b" => 200, :c => "c" }
|
||||||
* h1["a"] #=> "a"
|
* h1["a"] #=> "a"
|
||||||
* h1.identical
|
* h1.compare_by_identity
|
||||||
* h1.identical? #=> true
|
* h1.compare_by_identity? #=> true
|
||||||
* h1["a"] #=> nil # different objects.
|
* h1["a"] #=> nil # different objects.
|
||||||
* h1[:c] #=> "c" # same symbols are all same.
|
* h1[:c] #=> "c" # same symbols are all same.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_hash_identical(VALUE hash)
|
rb_hash_compare_by_identity(VALUE hash)
|
||||||
{
|
{
|
||||||
rb_hash_modify(hash);
|
rb_hash_modify(hash);
|
||||||
RHASH(hash)->tbl->type = &identhash;
|
RHASH(hash)->tbl->type = &identhash;
|
||||||
@ -1507,15 +1507,15 @@ rb_hash_identical(VALUE hash)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* hsh.identical? => true or false
|
* hsh.compare_by_identity? => true or false
|
||||||
*
|
*
|
||||||
* Returns <code>true</code> if <i>hsh</i> will compare its keys by
|
* Returns <code>true</code> if <i>hsh</i> will compare its keys by
|
||||||
* their identity. Also see <code>Hash#identical</code>.
|
* their identity. Also see <code>Hash#compare_by_identity</code>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
rb_hash_identical_p(VALUE hash)
|
rb_hash_compare_by_identity_p(VALUE hash)
|
||||||
{
|
{
|
||||||
if (RHASH(hash)->tbl->type == &identhash) {
|
if (RHASH(hash)->tbl->type == &identhash) {
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
@ -2372,8 +2372,8 @@ Init_Hash(void)
|
|||||||
rb_define_method(rb_cHash,"key?", rb_hash_has_key, 1);
|
rb_define_method(rb_cHash,"key?", rb_hash_has_key, 1);
|
||||||
rb_define_method(rb_cHash,"value?", rb_hash_has_value, 1);
|
rb_define_method(rb_cHash,"value?", rb_hash_has_value, 1);
|
||||||
|
|
||||||
rb_define_method(rb_cHash,"identical", rb_hash_identical, 0);
|
rb_define_method(rb_cHash,"compare_by_identity", rb_hash_compare_by_identity, 0);
|
||||||
rb_define_method(rb_cHash,"identical?", rb_hash_identical_p, 0);
|
rb_define_method(rb_cHash,"compare_by_identity?", rb_hash_compare_by_identity_p, 0);
|
||||||
|
|
||||||
#ifndef __MACOS__ /* environment variables nothing on MacOS. */
|
#ifndef __MACOS__ /* environment variables nothing on MacOS. */
|
||||||
origenviron = environ;
|
origenviron = environ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user