Class: Vagalume::SearchResult
- Inherits:
-
Object
- Object
- Vagalume::SearchResult
- Defined in:
- lib/vagalume/search_result.rb
Instance Attribute Summary collapse
-
#artist ⇒ Object
Returns the value of attribute artist.
-
#song ⇒ Object
Returns the value of attribute song.
-
#status ⇒ Object
Returns the value of attribute status.
-
#translations ⇒ Object
Returns the value of attribute translations.
Instance Method Summary collapse
-
#initialize(result) ⇒ SearchResult
constructor
A new instance of SearchResult.
- #not_found? ⇒ Boolean
Constructor Details
#initialize(result) ⇒ SearchResult
Returns a new instance of SearchResult.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/vagalume/search_result.rb', line 5 def initialize(result) @translations = [] @status = result["type"] return if not_found? song = result["mus"].first artist = result["art"] translations = song["translate"] || [] @song = Vagalume::Song.new(song) @artist = Vagalume::Artist.new(artist) translations.each do |translation| @translations << Vagalume::Song.new(translation) end end |
Instance Attribute Details
#artist ⇒ Object
Returns the value of attribute artist.
3 4 5 |
# File 'lib/vagalume/search_result.rb', line 3 def artist @artist end |
#song ⇒ Object
Returns the value of attribute song.
3 4 5 |
# File 'lib/vagalume/search_result.rb', line 3 def song @song end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/vagalume/search_result.rb', line 3 def status @status end |
#translations ⇒ Object
Returns the value of attribute translations.
3 4 5 |
# File 'lib/vagalume/search_result.rb', line 3 def translations @translations end |