module Nuggets::Array::HashifyMixin
Public Instance Methods
hashify(value = nil, &block)
click to toggle source
# File lib/nuggets/array/hashify_mixin.rb 31 def hashify(value = nil, &block) 32 block ||= lambda { |key| [key, key] } 33 34 hash = case value 35 when ::Hash then value 36 when ::Proc then ::Hash.new(&value) 37 else ::Hash.new(value) 38 end 39 40 each { |key| hash.store(*block[key]) } 41 42 hash 43 end