/* * call-seq: * hsh[key] => value * * Element Reference---Retrieves the <i>value</i> object corresponding * to the <i>key</i> object. If not found, returns the a default value (see * <code>Hash::new</code> for details). * * h = { "a" => 100, "b" => 200 } * h["a"] #=> 100 * h["c"] #=> nil * */ 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; }