Skip to content

Instantly share code, notes, and snippets.

@rbeene
Last active December 11, 2015 13:38
Show Gist options
  • Save rbeene/4609068 to your computer and use it in GitHub Desktop.
Save rbeene/4609068 to your computer and use it in GitHub Desktop.
REMOVE_WORDS_ARRAY = ["llc", "co", "corp", "inc"]
businesses_array = [["the bakery", "10012"],["law office inc", "10014"]]
businesses_hashes = []
businesses_array.each do |business|
our_hash = {}
our_hash['BusinessName'] = business[0].strip unless business[0].nil?
our_hash['BusinessZipCode'] = business[1].strip unless business[1].nil?
our_hash.each {|key, value|
value = (value.downcase.split(' ') - REMOVE_WORDS_ARRAY).join("+")
puts "value is #{value}"
our_hash[key] = value
}
businesses_hashes << our_hash
end
puts businesses_hashes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment