class Vagalume::SearchResult

Attributes

artist[RW]
song[RW]
status[RW]
translations[RW]

Public Class Methods

new(result) click to toggle source
# 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

Public Instance Methods

not_found?() click to toggle source
# File lib/vagalume/search_result.rb, line 21
def not_found?
   @status == Vagalume::Status::NOT_FOUND ||
   @status == Vagalume::Status::SONG_NOT_FOUND
end