mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* hash.c (env_key): ENV.index is deprecated as well as Hash#index.
use ENV.key instead. [ruby-dev:25974] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4f8df7dcc4
commit
373282f665
2 changed files with 17 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Sat Apr 2 13:23:17 2005 Hirokazu Yamamoto <ocean@m2.ccsnet.ne.jp>
|
||||
|
||||
* hash.c (env_key): ENV.index is deprecated as well as Hash#index.
|
||||
use ENV.key instead. [ruby-dev:25974]
|
||||
|
||||
Sat Apr 2 02:19:11 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk.rb (TkWindow.initialize): accept 'without_creating'
|
||||
|
|
15
hash.c
15
hash.c
|
@ -591,8 +591,8 @@ key_i(key, value, args)
|
|||
* Returns the key for a given value. If not found, returns <code>nil</code>.
|
||||
*
|
||||
* h = { "a" => 100, "b" => 200 }
|
||||
* h.index(200) #=> "b"
|
||||
* h.index(999) #=> nil
|
||||
* h.key(200) #=> "b"
|
||||
* h.key(999) #=> nil
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -2317,7 +2317,7 @@ env_has_value(dmy, value)
|
|||
}
|
||||
|
||||
static VALUE
|
||||
env_index(dmy, value)
|
||||
env_key(dmy, value)
|
||||
VALUE dmy, value;
|
||||
{
|
||||
char **env;
|
||||
|
@ -2342,6 +2342,14 @@ env_index(dmy, value)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
env_index(dmy, value)
|
||||
VALUE dmy, value;
|
||||
{
|
||||
rb_warn("ENV.index is deprecated; use ENV.key");
|
||||
return env_key(dmy, value);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
env_to_hash()
|
||||
{
|
||||
|
@ -2559,6 +2567,7 @@ Init_Hash()
|
|||
rb_define_singleton_method(envtbl,"rehash", env_none, 0);
|
||||
rb_define_singleton_method(envtbl,"to_a", env_to_a, 0);
|
||||
rb_define_singleton_method(envtbl,"to_s", env_to_s, 0);
|
||||
rb_define_singleton_method(envtbl,"key", env_key, 1);
|
||||
rb_define_singleton_method(envtbl,"index", env_index, 1);
|
||||
rb_define_singleton_method(envtbl,"size", env_size, 0);
|
||||
rb_define_singleton_method(envtbl,"length", env_size, 0);
|
||||
|
|
Loading…
Reference in a new issue