Sha256: e19e4d549c031dec6f0aa71e675fee76a76d6b304d78a44b6565493661f21cd1
Contents?: true
Size: 360 Bytes
Versions: 29
Compression:
Stored size: 360 Bytes
Contents
describe "Hash#index" do it "returns the corresponding key for value" do {2 => 'a', 1 => 'b'}.index('b').should == 1 end it "returns nil if the value is not found" do {:a => -1, :b => 3.14, :c => 2.718}.index(1).should be_nil end it "doesn't return default value if the value isn't found" do Hash.new(5).index(5).should be_nil end end
Version data entries
29 entries across 29 versions & 1 rubygems