Mash#fetch doesn't respect existing keys #93

Closed
markiz opened this Issue Apr 23, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@markiz
Contributor

markiz commented Apr 23, 2013

Hashie 2.0.3

1.9.3p392 :001 > require 'hashie'
true
1.9.3p392 :002 > h = Hashie::Mash.new
{}
1.9.3p392 :003 > h[:key] = nil
nil
1.9.3p392 :004 > h.fetch(:key, 123)
123

Expected: nil (consistent with what ruby Hash does)
Got: 123

fetch should check, whether key is present in the Mash.

falsy values are values like any other.

@jch

This comment has been minimized.

Show comment
Hide comment
@jch

jch Apr 23, 2013

Contributor

Good catch. Would you be interested in creating a pull request for it? 😉

Contributor

jch commented Apr 23, 2013

Good catch. Would you be interested in creating a pull request for it? 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment