X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/34d0bf15a6f4009de376ceed1d7d5cca24a8dfe7..f2ec7254120c90c3b023687f67a7b19f78b69370:/lib/lyricli/lyrics_engine.rb?ds=sidebyside diff --git a/lib/lyricli/lyrics_engine.rb b/lib/lyricli/lyrics_engine.rb index 65e36db..beacd46 100644 --- a/lib/lyricli/lyrics_engine.rb +++ b/lib/lyricli/lyrics_engine.rb @@ -1,12 +1,21 @@ module Lyricli + + # This class gets the lyrics according to a given artist and song name. class LyricsEngine include Util + # Starts a new instance of LyricsEngine + # + # @param [String] artist the artist + # @param [String] song the song to look for def initialize(artist, song) @provider = URI("http://lyrics.wikia.com/api.php?artist=#{sanitize_param artist}&song=#{sanitize_param song}&fmt=realjson") end + # Asks Lyrics Wiki for the lyrics, also cleans up the output a little. + # + # @return [String] the lyrics def get_lyrics begin response = Net::HTTP.get(@provider) @@ -28,6 +37,5 @@ module Lyricli node.inner_text end - end end