Method: Enumerable#build_hash

Defined in:
lib/hobosupport/enumerable.rb

#build_hashObject



17
18
19
20
21
22
23
24
# File 'lib/hobosupport/enumerable.rb', line 17

def build_hash
  res = {}
  each do |x|
    pair = yield x
    res[pair.first] = pair.last if pair
  end
  res
end