Method: Immutable::Hash#each_value

Defined in:
lib/immutable/hash.rb

#each_value {|value| ... } ⇒ self

Call the block once for each key/value pair in this Hash, passing the value as a parameter. Ordering guarantees are the same as #each.

Examples:

Immutable::Hash["A" => 1, "B" => 2, "C" => 3].each_value { |v| puts "v=#{v}" }

v=1
v=3
v=2
# => Immutable::Hash["A" => 1, "B" => 2, "C" => 3]

Yields:

  • (value)

    Once for each key/value pair.

Returns:

  • (self)


404
405
406
407
408
# File 'lib/immutable/hash.rb', line 404

def each_value
  return enum_for(:each_value) if not block_given?
  @trie.each { |k,v| yield v }
  self
end