X-Git-Url: https://git.r.bdr.sh/rbdr/lyricli.rb/blobdiff_plain/34d0bf15a6f4009de376ceed1d7d5cca24a8dfe7..b2ac68932fa671151d3ab3115c565fa9ad06420c:/doc/Lyricli/Lyricli.html diff --git a/doc/Lyricli/Lyricli.html b/doc/Lyricli/Lyricli.html index 090262d..e3accb5 100644 --- a/doc/Lyricli/Lyricli.html +++ b/doc/Lyricli/Lyricli.html @@ -99,8 +99,21 @@
++This class has the basic logic for extracting the lyrics and controlling +the application +
++Exits with error when there is an empty field from the current track. +
++Raises an InvalidLyricsError which means we did not get any valid +artist/song from any of the sources. +
++Extracts the current track, validates it and requests the lyrics from our +LyricsEngine. +
+-A new instance of Lyricli. +Constructor, initializes `@source_manager`.
+Set the `@current_track` instance variable by asking the SourceManager for +its current track. +
+-A new instance of Lyricli +Constructor, initializes `@source_manager`
@@ -262,12 +290,12 @@ A new instance of Lyricli-4 -5 -6+8 +9 +10
# File 'lib/lyricli/lyricli.rb', line 4 +# File 'lib/lyricli/lyricli.rb', line 8 def initialize @source_manager = SourceManager.new @@ -293,21 +321,35 @@ A new instance of Lyricli -
-29 -30 -31 -32+49 +50 +51 +52 +53 |
- # File 'lib/lyricli/lyricli.rb', line 29 +# File 'lib/lyricli/lyricli.rb', line 49 def check_params + self.exit_with_error unless @current_track self.exit_with_error if @current_track[:artist].nil? or @current_track[:artist].empty? self.exit_with_error if @current_track[:song].nil? or @current_track[:song].empty? end@@ -327,7 +369,11 @@ A new instance of Lyricli +because we found nothing + +-8 -9 -10+16 +17 +18 |
- # File 'lib/lyricli/lyricli.rb', line 8 +# File 'lib/lyricli/lyricli.rb', line 16 def exit_with_error - raise InvalidLyrics + raise Exceptions::InvalidLyricsError end |
-12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23+24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 |
- # File 'lib/lyricli/lyricli.rb', line 12 +# File 'lib/lyricli/lyricli.rb', line 24 def get_lyrics - set_current_track - check_params + + begin + set_current_track + check_params + rescue Exceptions::InvalidLyricsError + return "No Artist/Song could be found :(" + end engine = LyricsEngine.new(@current_track[:artist], @current_track[:song]) begin - engine.get_lyrics - rescue LyricsNotFoundException - "Lyrics not found :(" + return engine.get_lyrics + rescue Exceptions::LyricsNotFoundError + return "Lyrics not found :(" end end |
@@ -425,18 +519,31 @@ A new instance of Lyricli
-
-25 -26 -27+44 +45 +46 |
- # File 'lib/lyricli/lyricli.rb', line 25 +# File 'lib/lyricli/lyricli.rb', line 44 def set_current_track @current_track = @source_manager.current_track @@ -451,7 +558,7 @@ A new instance of Lyricli |