Skip to content

Instantly share code, notes, and snippets.

@justuseapen
Created November 18, 2013 18:27
Show Gist options
  • Save justuseapen/7532804 to your computer and use it in GitHub Desktop.
Save justuseapen/7532804 to your computer and use it in GitHub Desktop.
salutations = [
'Mr.',
'Mrs.',
'Mr.',
'Dr.',
'Ms.'
]
first_names = [
'John',
'Jane',
'Sam',
'Louise',
'Kyle'
]
last_names = [
'Dillinger',
'Cook',
'Livingston',
'Levinger',
'Merlotte'
]
addresses = [
'33 Foolish Lane, Boston MA 02210',
'45 Cottage Way, Dartmouth, MA 02342',
"54 Sally's Court, Bridgewater, MA 02324",
'4534 Broadway, Boston, MA 02110',
'4231 Cynthia Drive, Raynham, MA 02767'
]
#First, I want to pull respective info from these
#arrays a build a hash that profiles each subject (name).
#Second, I want to build an array made from these hashes
array = []
addresses.each_with_index do |address, index|
profile = {
salutation: salutations[index],
first_name: first_names[index],
last_name: last_names[index],
address: addresses[index]
}
array.push(profile)
end
puts array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment