Sha256: f60844fb35f10e20be3b39295433575dc482f868bbd0e9348c5ac47d67eb1438
Contents?: true
Size: 289 Bytes
Versions: 3
Compression:
Stored size: 289 Bytes
Contents
class Array # # Gets value of block on each element; # constructs a hash of element-value pairs # # @return [Hash] hash of key-value pairs def hashify raise ArgumentError, 'hashify requires a block' unless block_given? Hash[ self.map{|el| [el, yield(el)] } ] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gorillib-0.6.0 | lib/gorillib/array/hashify.rb |
gorillib-0.5.2 | lib/gorillib/array/hashify.rb |
gorillib-0.5.0 | lib/gorillib/array/hashify.rb |