Mezbah
Mezbah

Reputation: 1267

warning Hash#index is deprecated use Hash#key

Why am I seeing this warning?

me = { 'name' => 'mezbah'}
me.index('mezbah') # => warning: Hash#index is deprecated; use Hash#key

Upvotes: 3

Views: 1732

Answers (1)

sawa
sawa

Reputation: 168121

Deprecated means that it was a feature in the past, and is still is but is not recommended to be used, and is planned to be removed from the feature in future version of Ruby, so you better not use it. In this particular case, follow the message and use key instead.

Upvotes: 7

Related Questions