summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hash.c9
-rw-r--r--spec/ruby/core/hash/index_spec.rb6
2 files changed, 4 insertions, 11 deletions
diff --git a/hash.c b/hash.c
index 132af403a7..bde35d06b0 100644
--- a/hash.c
+++ b/hash.c
@@ -2309,14 +2309,6 @@ rb_hash_key(VALUE hash, VALUE value)
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)
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 2b52c69949..009e222f12 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'
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