Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/apocalypse-client.rb

Class Method Summary collapse

Class Method Details

.zip(keys, values, default = nil, &block) ⇒ Object

Create a hash from an array of keys and corresponding values.



13
14
15
16
17
# File 'lib/apocalypse-client.rb', line 13

def self.zip(keys, values, default=nil, &block)
  hsh = block_given? ? Hash.new(&block) : Hash.new(default)
  keys.zip(values) { |k,v| hsh[k]=v }
  hsh
end