Class: Karaoke::Song::LyricsMania
- Inherits:
-
Base
- Object
- Base
- Karaoke::Song::LyricsMania
show all
- Defined in:
- lib/karaoke/song/lyrics_mania.rb
Instance Attribute Summary
Attributes inherited from Base
#lyrics_url
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Class Method Details
.matches?(lyrics_url) ⇒ Boolean
6
7
8
|
# File 'lib/karaoke/song/lyrics_mania.rb', line 6
def self.matches?(lyrics_url)
URI.parse(lyrics_url).host.end_with?("lyricsmania.com")
end
|
Instance Method Details
#artist ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/karaoke/song/lyrics_mania.rb', line 10
def artist
return @artist if defined?(@artist)
el = document.css(".lyrics-nav hgroup h3").first
return @artist = nil unless el
@artist = el.text
end
|
#lyrics ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/karaoke/song/lyrics_mania.rb', line 28
def lyrics
return @lyrics if defined?(@lyrics)
el = document.css(".lyrics-body").first || document.css(".lyrics .col-left").first
return @lyrics = nil unless el
el.css("div").remove
el.css("strong").remove
@lyrics = clean_html(el.inner_html)
end
|
#title ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/karaoke/song/lyrics_mania.rb', line 19
def title
return @title if defined?(@title)
el = document.css(".lyrics-nav hgroup h2").first
return @title = nil unless el
@title = el.text.match("^(.+?) lyrics$")[1]
end
|