Module: Tzispa::Helpers::HashTrans

Included in:
Crawler
Defined in:
lib/tzispa/helpers/hash_trans.rb

Instance Method Summary collapse

Instance Method Details

#hash_fussion!(hash, fussion_keys = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/tzispa/helpers/hash_trans.rb', line 5

def hash_fussion!(hash, fussion_keys={})
  hash.keys.each { |key|
    if fussion_keys.has_key?(key)
      hash[fussion_keys[key]] ?
        hash[fussion_keys[key]] += hash[key] :
        hash[fussion_keys[key]] = hash[key]
      hash.delete(key)
    end
  } unless fussion_keys.empty?
end