Class: Array

Inherits:
Object show all
Defined in:
lib/util.rb

Instance Method Summary collapse

Instance Method Details

#to_h(&block) ⇒ Object



9
10
11
12
13
# File 'lib/util.rb', line 9

def to_h(&block)
  Hash[*self.collect { |v|
    [v, block.call(v)]
  }.flatten]
end