Module: Enumerable

Defined in:
lib/orange-core/magick.rb

Overview

Monkey patch for awesome array -> hash conversions use:

[:x, :y, :z].inject_hash do |results, letter|
  results[letter] = rand(100)
end

# => {:x => 32, :y => 63, :z => 91}

Instance Method Summary collapse

Instance Method Details

#inject_hash(hash = {}) ⇒ Object

:nodoc:



35
36
37
# File 'lib/orange-core/magick.rb', line 35

def inject_hash(hash = {}) 
  inject(hash) {|(h,item)| yield(h,item); h}
end