Created
October 25, 2012 20:11
-
-
Save havenwood/3955113 to your computer and use it in GitHub Desktop.
Hash#[] from Ruby hash.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VALUE | |
rb_hash_aref(hash, key) | |
VALUE hash, key; | |
{ | |
VALUE val; | |
if (!st_lookup(RHASH(hash)->tbl, key, &val)) { | |
return rb_funcall(hash, id_default, 1, key); | |
} | |
return val; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment