Sha256: 664642b5ca1c34926cbd27f47941394ed1fde774f34407853974f42ce595ad4a
Contents?: true
Size: 610 Bytes
Versions: 11
Compression:
Stored size: 610 Bytes
Contents
module DataMapper; module Ext module Array # Transforms an Array of key/value pairs into a {Mash}. # # This is a better idiom than using Mash[*array.flatten] in Ruby 1.8.6 # because it is not possible to limit the flattening to a single # level. # # @param [Array] array # The array of key/value pairs to transform. # # @return [Mash] # A {Mash} where each entry in the Array is turned into a key/value. # # @api semipublic def self.to_mash(array) m = Mash.new array.each { |k,v| m[k] = v } m end end # class Array end; end
Version data entries
11 entries across 11 versions & 4 rubygems