Skip to content

Instantly share code, notes, and snippets.

@loganhasson
Created September 26, 2013 22:17
Show Gist options
  • Save loganhasson/6721358 to your computer and use it in GitHub Desktop.
Save loganhasson/6721358 to your computer and use it in GitHub Desktop.
songs = [
"The Magnetic Fields - 69 Love Songs - Parades Go By",
"The Magnetic Fields - Get Lost - Smoke and Mirrors",
"Neutral Milk Hotel - In An Aeroplane Over the Sea - Holland 1945",
"The Magnetic Fields - Get Lost - You, Me, and the Moon",
"The Magnetic Fields - 69 Love Songs - The Book of Love",
"Neutral Milk Hotel - In An Aeroplane Over the Sea - The King of Carrot Flowers"
]
airplane = []
sixty_nine_songs = []
get_lost = []
songs.each do |song|
song = song.split(' - ')
case song[0]
when "Neutral Milk Hotel"
airplane << song.join(' - ')
when "The Magnetic Fields"
if song.include?("69 Love Songs")
love_song = song.join(' - ')
sixty_nine_songs << love_song
else
love_song = song.join(' - ')
get_lost << love_song
end
end
end
airplane.each do |song|
puts song
end
sixty_nine_songs.each do |song|
puts song
end
get_lost.each do |song|
puts song
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment