Skip to content

Instantly share code, notes, and snippets.

@methodmissing
Created June 3, 2009 21:58
Show Gist options
  • Select an option

  • Save methodmissing/123275 to your computer and use it in GitHub Desktop.

Select an option

Save methodmissing/123275 to your computer and use it in GitHub Desktop.
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