Class: Vagalume::Song
- Inherits:
-
Object
- Object
- Vagalume::Song
- Defined in:
- lib/vagalume/song.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#lyric ⇒ Object
Returns the value of attribute lyric.
-
#name ⇒ Object
Returns the value of attribute name.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(song) ⇒ Song
constructor
A new instance of Song.
- #translation? ⇒ Boolean
Constructor Details
#initialize(song) ⇒ Song
Returns a new instance of Song.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/vagalume/song.rb', line 5 def initialize(song) @id = song["id"] @language = song["lang"] @url = song["url"] @lyric = song["text"] @name = song["name"] if translation? @name = get_name_from_lyric(@lyric) @lyric = remove_title(@lyric) end end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/vagalume/song.rb', line 3 def id @id end |
#language ⇒ Object
Returns the value of attribute language.
3 4 5 |
# File 'lib/vagalume/song.rb', line 3 def language @language end |
#lyric ⇒ Object
Returns the value of attribute lyric.
3 4 5 |
# File 'lib/vagalume/song.rb', line 3 def lyric @lyric end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/vagalume/song.rb', line 3 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/vagalume/song.rb', line 3 def url @url end |
Instance Method Details
#translation? ⇒ Boolean
18 19 20 |
# File 'lib/vagalume/song.rb', line 18 def translation? @name.nil? end |