Module: Ragol::HashUtil

Defined in:
lib/ragol/hash.rb

Class Method Summary collapse

Class Method Details

.copy_hash(to_hash, from_hash, fields = Array.new) ⇒ Object



6
7
8
9
10
# File 'lib/ragol/hash.rb', line 6

def self.copy_hash to_hash, from_hash, fields = Array.new
  fields.each do |fieldnames|
    to_hash[fieldnames.first] = from_hash[fieldnames.find { |x| from_hash[x] }]
  end
end

.hash_array_value(hash, array) ⇒ Object



12
13
14
# File 'lib/ragol/hash.rb', line 12

def self.hash_array_value hash, array
  hash[(array & hash.keys)[0]]
end