Skip to content

Instantly share code, notes, and snippets.

@ahimmelstoss
Last active December 24, 2015 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahimmelstoss/6721180 to your computer and use it in GitHub Desktop.
Save ahimmelstoss/6721180 to your computer and use it in GitHub Desktop.
require 'awesome_print'
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"
]
def sort_by_band(artist_name, songs_array)
artist_name_array = []
songs_array.each do |song|
if song.split(" - ").first == artist_name
artist_name_array.push song
end
end
ap artist_name_array.sort!
end
sort_by_band("The Magnetic Fields", songs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment