Sha256: c7e1a035aae4f527a67ba89d834d5add688c420117ab87e179b5891895ac80e4
Contents?: true
Size: 295 Bytes
Versions: 4
Compression:
Stored size: 295 Bytes
Contents
module Enumerable # Converts an enumerable into a hash, by accepting an initial value # or a block to compute the value for a given key. def to_hash(init_val = nil) hash = {} self.each do |key| hash[key] = block_given? ? yield(key) : init_val end hash end end
Version data entries
4 entries across 4 versions & 1 rubygems