Skip to content

Instantly share code, notes, and snippets.

@ivanbrennan
Created October 8, 2013 15:09
Show Gist options
  • Select an option

  • Save ivanbrennan/6886240 to your computer and use it in GitHub Desktop.

Select an option

Save ivanbrennan/6886240 to your computer and use it in GitHub Desktop.
juke-scraps
songs = [
"The Phoenix - 1901",
"Tokyo Police Club - Wait Up",
"Sufjan Stevens - Too Much",
"The Naked and the Famous - Young Blood",
"(Far From) Home - Tiga",
"The Cults - Abducted",
"The Phoenix - Consolation Prizes"
]
user_input = gets.chomp
choice = songs.find do |song|
song.match(user_input)
end
def suggester(songs, test)
songs.each do |each_song|
match_chars = each_song.chars.select do |char|
test.chars.include?(char)
end
if match_chars.length > test.length/2
return each_song
end
end
end
def parser(input_str)
if is_name?(input_str)
self.songs.each_key do |song|
song_title = song.split(" - ").last
return song
end
end
if is_index?(input_str)
end
end
def is_name?(input_str)
input_str.scan()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment