]> git.r.bdr.sh - rbdr/lyricli.rb/blobdiff - doc/Lyricli/Lyricli.html
Merge pull request #2 from orlando/master
[rbdr/lyricli.rb] / doc / Lyricli / Lyricli.html
index 6d8ed13045ffac8027e0a5ffa63b366ae501ed72..e3accb5aea6f641012fee32b993385c97d432be2 100644 (file)
@@ -6,7 +6,7 @@
 <title>
   Class: Lyricli::Lyricli
   
 <title>
   Class: Lyricli::Lyricli
   
-    &mdash; Documentation by YARD 0.8.1
+    &mdash; Documentation by YARD 0.8.2.1
   
 </title>
 
   
 </title>
 
   
   
     <dt class="r2 last">Defined in:</dt>
   
   
     <dt class="r2 last">Defined in:</dt>
-    <dd class="r2 last">lib/lyricli.rb</dd>
+    <dd class="r2 last">lib/lyricli/lyricli.rb</dd>
   
 </dl>
 <div class="clear"></div>
 
   
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+This class has the basic logic for extracting the lyrics and controlling
+the application
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
 
 
+</div>
 
 
 
 
 
 
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Exits with error when there is an empty field from the current track.
+</p>
+</div></span>
   
 </li>
 
   
 </li>
 
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Raises an InvalidLyricsError which means we did not get any valid
+artist/song from any of the sources.
+</p>
+</div></span>
   
 </li>
 
   
 </li>
 
         <li class="public ">
   <span class="summary_signature">
     
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (Object) <strong>get_lyrics</strong> </a>
+      <a href="#get_lyrics-instance_method" title="#get_lyrics (instance method)">- (String) <strong>get_lyrics</strong> </a>
     
 
     
     
 
     
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Extracts the current track, validates it and requests the lyrics from our
+LyricsEngine.
+</p>
+</div></span>
   
 </li>
 
   
 </li>
 
 
   
     <span class="summary_desc"><div class='inline'><p>
 
   
     <span class="summary_desc"><div class='inline'><p>
-A new instance of Lyricli.
+Constructor, initializes `@source_manager`.
 </p>
 </div></span>
   
 </p>
 </div></span>
   
@@ -224,7 +248,11 @@ A new instance of Lyricli.
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Set the `@current_track` instance variable by asking the SourceManager for
+its current track.
+</p>
+</div></span>
   
 </li>
 
   
 </li>
 
@@ -247,7 +275,7 @@ A new instance of Lyricli.
 </h3><div class="docstring">
   <div class="discussion">
     <p>
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-A new instance of Lyricli
+Constructor, initializes `@source_manager`
 </p>
 
 
 </p>
 
 
@@ -262,12 +290,12 @@ A new instance of Lyricli
       <pre class="lines">
 
 
       <pre class="lines">
 
 
-36
-37
-38</pre>
+8
+9
+10</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 36</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 8</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@source_manager</span> <span class='op'>=</span> <span class='const'>SourceManager</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@source_manager</span> <span class='op'>=</span> <span class='const'>SourceManager</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
@@ -293,21 +321,35 @@ A new instance of Lyricli
   
 
   
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Exits with error when there is an empty field from the current track.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
-61
-62
-63
-64</pre>
+49
+50
+51
+52
+53</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 61</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 49</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_check_params'>check_params</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_check_params'>check_params</span>
+  <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>unless</span> <span class='ivar'>@current_track</span>
   <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
   <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
 <span class='kw'>end</span></pre>
   <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
   <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_exit_with_error'>exit_with_error</span> <span class='kw'>if</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
 <span class='kw'>end</span></pre>
@@ -325,21 +367,53 @@ A new instance of Lyricli
   
 
   
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Raises an InvalidLyricsError which means we did not get any valid
+artist/song from any of the sources
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+<p class="tag_title">Raises:</p>
+<ul class="raise">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt><span class='object_link'><a href="Exceptions/InvalidLyricsError.html" title="Lyricli::Exceptions::InvalidLyricsError (class)">Lyricli::Exceptions::InvalidLyricsError</a></span></tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+because we found nothing
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
-40
-41
-42</pre>
+16
+17
+18</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 40</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 16</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_exit_with_error'>exit_with_error</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_exit_with_error'>exit_with_error</span>
-  <span class='id identifier rubyid_abort'>abort</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Usage: </span><span class='embexpr_beg'>#{</span><span class='gvar'>$0</span><span class='rbrace'>}</span><span class='tstring_content'> artist song</span><span class='tstring_end'>&quot;</span></span>
+  <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>InvalidLyricsError</span>
 <span class='kw'>end</span></pre>
     </td>
   </tr>
 <span class='kw'>end</span></pre>
     </td>
   </tr>
@@ -349,44 +423,86 @@ A new instance of Lyricli
       <div class="method_details ">
   <h3 class="signature " id="get_lyrics-instance_method">
   
       <div class="method_details ">
   <h3 class="signature " id="get_lyrics-instance_method">
   
-    - (<tt>Object</tt>) <strong>get_lyrics</strong> 
+    - (<tt>String</tt>) <strong>get_lyrics</strong> 
   
 
   
 
   
   
 
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Extracts the current track, validates it and requests the lyrics from our
+LyricsEngine
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the found lyrics, or a string indicating none were found
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55</pre>
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 44</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 24</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
-  <span class='id identifier rubyid_set_current_track'>set_current_track</span>
-  <span class='id identifier rubyid_check_params'>check_params</span>
+
+  <span class='kw'>begin</span>
+    <span class='id identifier rubyid_set_current_track'>set_current_track</span>
+    <span class='id identifier rubyid_check_params'>check_params</span>
+  <span class='kw'>rescue</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>InvalidLyricsError</span>
+    <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No Artist/Song could be found :(</span><span class='tstring_end'>&quot;</span></span>
+  <span class='kw'>end</span>
 
   <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='const'>LyricsEngine</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='rparen'>)</span>
 
   <span class='kw'>begin</span>
 
   <span class='id identifier rubyid_engine'>engine</span> <span class='op'>=</span> <span class='const'>LyricsEngine</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:artist</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@current_track</span><span class='lbracket'>[</span><span class='symbol'>:song</span><span class='rbracket'>]</span><span class='rparen'>)</span>
 
   <span class='kw'>begin</span>
-    <span class='id identifier rubyid_engine'>engine</span><span class='period'>.</span><span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
-  <span class='kw'>rescue</span> <span class='const'>LyricsNotFoundException</span>
-    <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Lyrics not found :(</span><span class='tstring_end'>&quot;</span></span>
+    <span class='kw'>return</span> <span class='id identifier rubyid_engine'>engine</span><span class='period'>.</span><span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
+  <span class='kw'>rescue</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>LyricsNotFoundError</span>
+    <span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Lyrics not found :(</span><span class='tstring_end'>&quot;</span></span>
   <span class='kw'>end</span>
 <span class='kw'>end</span></pre>
     </td>
   <span class='kw'>end</span>
 <span class='kw'>end</span></pre>
     </td>
@@ -403,18 +519,31 @@ A new instance of Lyricli
   
 
   
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Set the `@current_track` instance variable by asking the SourceManager for
+its current track
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
-57
-58
-59</pre>
+44
+45
+46</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 57</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/lyricli.rb', line 44</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_set_current_track'>set_current_track</span>
   <span class='ivar'>@current_track</span> <span class='op'>=</span> <span class='ivar'>@source_manager</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_set_current_track'>set_current_track</span>
   <span class='ivar'>@current_track</span> <span class='op'>=</span> <span class='ivar'>@source_manager</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span>
@@ -429,9 +558,9 @@ A new instance of Lyricli
 </div>
 
     <div id="footer">
 </div>
 
     <div id="footer">
-  Generated on Fri Oct  5 22:31:14 2012 by
+  Generated on Sat Oct  6 03:20:24 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
-  0.8.1 (ruby-1.9.2).
+  0.8.2.1 (ruby-1.9.2).
 </div>
 
   </body>
 </div>
 
   </body>