Module: LyricsFinder

Defined in:
lib/lyrics_finder.rb,
lib/lyrics_finder/version.rb,
lib/lyrics_finder/providers.rb

Defined Under Namespace

Modules: Providers

Constant Summary collapse

VERSION =
"0.2.3"

Class Method Summary collapse

Class Method Details

.search(author, title) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/lyrics_finder.rb', line 12

def self.search(author, title)
  Providers.list.each do |provider|
    url = Providers.provider_url_for_song(provider, Song.new(author, title))
    data = perform_request(url)
    result = Providers.extract_lyric_from_data(data) unless data.nil?
    return result unless result.nil?
  end
  return nil # song not found
end