Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/lib/util.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.zipnew(keys, values) ⇒ Object

File facets/hash/new.rb, line 44



62
63
64
65
66
# File 'lib/lib/util.rb', line 62

def self.zipnew(keys,values) # or some better name
  h = {}
  keys.size.times{ |i| h[ keys[i] ] = values[i] }
  h
end

Instance Method Details

#normalize_keys!(&block) ⇒ Object

File facets/hash/keyize.rb, line 49



68
69
70
71
72
73
74
# File 'lib/lib/util.rb', line 68

def normalize_keys!( &block )
  keys.each{ |k|
    nk = block[k]
    self[nk]=delete(k) if nk
  }
  self
end