Method: Hash#each_value
- Defined in:
- hash.c
#each_value {|value| ... } ⇒ Hash #each_value ⇒ Object
Calls block once for each key in hsh, passing the value as a parameter.
If no block is given, an enumerator is returned instead.
h = { "a" => 100, "b" => 200 }
h.each_value {|value| puts value }
produces:
100
200
1685 1686 1687 1688 1689 1690 1691 |
# File 'hash.c', line 1685
static VALUE
rb_hash_each_value(VALUE hash)
{
RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_foreach(hash, each_value_i, 0);
return hash;
}
|