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:



38
39
40
# File 'lib/orange-core/magick.rb', line 38

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