Module: LyricsFinder::Provider
- Defined in:
- lib/lyrics_finder/provider.rb
Defined Under Namespace
Classes: LyricsWikia, SongLyrics
Class Method Summary
collapse
Class Method Details
12
13
14
15
16
17
18
19
20
|
# File 'lib/lyrics_finder/provider.rb', line 12
def self.(data)
html = Nokogiri::HTML(data)
lyrics_container = html.css(@current_provider.css_element).first
unless lyrics_container.nil?
elements = lyrics_container.children.to_a
phrases = elements.select { |el| el.text? && el.text != "\n" && !el.blank? }
phrases.map! { |element| element.text.strip }
end
end
|
.list ⇒ Object
3
4
5
|
# File 'lib/lyrics_finder/provider.rb', line 3
def self.list
[LyricsWikia, SongLyrics]
end
|
.url_for_song(provider, song) ⇒ Object
7
8
9
10
|
# File 'lib/lyrics_finder/provider.rb', line 7
def self.url_for_song(provider, song)
@current_provider = provider.new(song)
@current_provider.format_url
end
|