[前][次][番号順一覧][スレッド一覧]

ruby-changes:63994

From: =E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3 <ko1@a...>
Date: Mon, 7 Dec 2020 18:36:38 +0900 (JST)
Subject: [ruby-changes:63994] 547c71dec4 (master): Hash#index: delete

https://git.ruby-lang.org/ruby.git/commit/?id=547c71dec4

From 547c71dec47561571b4862dda0395fb0b08d6c1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?=
 <shyouhei@r...>
Date: Mon, 27 Jul 2020 10:19:58 +0900
Subject: Hash#index: delete

Has been deprecated since 0c97c8e33584e6203bb09c08f92b63bd2cca8ae7.

diff --git a/hash.c b/hash.c
index 132af40..bde35d0 100644
--- a/hash.c
+++ b/hash.c
@@ -2309,14 +2309,6 @@ rb_hash_key(VALUE hash, VALUE value) https://github.com/ruby/ruby/blob/trunk/hash.c#L2309
     return args[1];
 }
 
-/* :nodoc: */
-static VALUE
-rb_hash_index(VALUE hash, VALUE value)
-{
-    rb_warn_deprecated("Hash#index", "Hash#key");
-    return rb_hash_key(hash, value);
-}
-
 int
 rb_hash_stlike_delete(VALUE hash, st_data_t *pkey, st_data_t *pval)
 {
@@ -6938,7 +6930,6 @@ Init_Hash(void) https://github.com/ruby/ruby/blob/trunk/hash.c#L6930
     rb_define_method(rb_cHash, "default_proc", rb_hash_default_proc, 0);
     rb_define_method(rb_cHash, "default_proc=", rb_hash_set_default_proc, 1);
     rb_define_method(rb_cHash, "key", rb_hash_key, 1);
-    rb_define_method(rb_cHash, "index", rb_hash_index, 1);
     rb_define_method(rb_cHash, "size", rb_hash_size, 0);
     rb_define_method(rb_cHash, "length", rb_hash_size, 0);
     rb_define_method(rb_cHash, "empty?", rb_hash_empty_p, 0);
diff --git a/spec/ruby/core/hash/index_spec.rb b/spec/ruby/core/hash/index_spec.rb
index 2b52c69..009e222 100644
--- a/spec/ruby/core/hash/index_spec.rb
+++ b/spec/ruby/core/hash/index_spec.rb
@@ -2,6 +2,8 @@ require_relative '../../spec_helper' https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/hash/index_spec.rb#L2
 require_relative 'fixtures/classes'
 require_relative 'shared/index'
 
-describe "Hash#index" do
-  it_behaves_like :hash_index, :index
+ruby_version_is ''...'2.8' do
+  describe "Hash#index" do
+    it_behaves_like :hash_index, :index
+  end
 end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]