Class: Valanga::Music
- Inherits:
-
Object
show all
- Defined in:
- lib/valanga/music.rb,
lib/valanga/music/base.rb,
lib/valanga/music/collete.rb,
lib/valanga/music/groovin.rb
Defined Under Namespace
Classes: Base, Collete, Groovin
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(document) ⇒ Music
Returns a new instance of Music.
3
4
5
6
7
8
9
10
|
# File 'lib/valanga/music.rb', line 3
def initialize(document)
@document = Nokogiri::HTML.parse(document, nil, 'Shift_JIS')
@music_bk = @document.css("div.music_bk dl")
unless @music_bk.size == 8 || @music_bk.size == 9
raise NoMusicInformationError, "Not found music informations"
end
end
|
Instance Attribute Details
#music_bk ⇒ Object
Returns the value of attribute music_bk.
12
13
14
|
# File 'lib/valanga/music.rb', line 12
def music_bk
@music_bk
end
|
Instance Method Details
#artist ⇒ Object
46
47
48
|
# File 'lib/valanga/music.rb', line 46
def artist
@artist ||= @document.css("div.music_artist h6").text
end
|
#collete ⇒ Object
30
31
32
|
# File 'lib/valanga/music.rb', line 30
def collete
Collete.new(self)
end
|
#groovin ⇒ Object
34
35
36
|
# File 'lib/valanga/music.rb', line 34
def groovin
Groovin.new(self)
end
|
#hard ⇒ Object
22
23
24
|
# File 'lib/valanga/music.rb', line 22
def hard
Difficulty::Hard.new(self)
end
|
#has_special? ⇒ Boolean
38
39
40
|
# File 'lib/valanga/music.rb', line 38
def has_special?
music_bk.size == 9
end
|
#name ⇒ Object
42
43
44
|
# File 'lib/valanga/music.rb', line 42
def name
@name ||= @document.css("div.music_dataname h6").text
end
|