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.
Class Method Summary collapse
Instance Method Summary collapse
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 |
Class Method Details
.fetch(song_json) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vagalume/song.rb', line 5 def self.fetch(song_json) song = Vagalume::Song.new song.id = song_json["id"] song.language = song_json["lang"] song.url = song_json["url"] song.lyric = song_json["text"] song.name = song_json["name"] if song.translation? song.name = get_name_from_lyric(song.lyric) song.lyric = remove_title(song.lyric) end song end |
Instance Method Details
#translation? ⇒ Boolean
19 20 21 |
# File 'lib/vagalume/song.rb', line 19 def translation? @name.nil? end |