def map_attributes(hmap, row)
hmap.inject({}) do |return_hash, hash_element|
attribute = hash_element[0]
value = hash_element[1]
if !value["map"].nil? && value["map"].to_s.match(/^\d/) #begins with digit or fk relationship
temp = translate_composite(row, value["map"].to_s).to_s.strip
temp = value["default"].to_s.strip if temp.blank?
else # !value[:default].nil?
temp = value["default"].to_s.strip
end
return_hash[attribute] = temp
return_hash
end
end

vs.

def map_attributes(hmap, row)
hmap.inject({}) do |return_hash, hash_element|
attribute = hash_element[0]
value = hash_element[1]
return_hash[attribute] = translate_composite(row, value["map"].to_s) || value["default"]
return_hash
end
end