]> git.r.bdr.sh - rbdr/lyricli.rb/blobdiff - doc/Lyricli/SourceManager.html
Update README
[rbdr/lyricli.rb] / doc / Lyricli / SourceManager.html
index 399b33744ea3528ba77a22b945a3d8003a73d018..a8ddaa0de1bd3addd9fbe3218255386c1d4bfd0b 100644 (file)
@@ -6,7 +6,7 @@
 <title>
   Class: Lyricli::SourceManager
   
 <title>
   Class: Lyricli::SourceManager
   
-    &mdash; Documentation by YARD 0.8.1
+    &mdash; Documentation by YARD 0.8.2.1
   
 </title>
 
   
 </title>
 
 </dl>
 <div class="clear"></div>
 
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+Manages the different sources. SourceManager is in charge of enabling and
+disabling them, as well as getting the current track.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
 
 
+</div>
 
 
 
 
 
 
         <li class="public ">
   <span class="summary_signature">
     
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#current_track-instance_method" title="#current_track (instance method)">- (Object) <strong>current_track</strong> </a>
+      <a href="#available_sources-instance_method" title="#available_sources (instance method)">- (Array) <strong>available_sources</strong>(format = false) </a>
+    
+
+    
+  </span>
+  
+  
+  
+  
+  
+  
+  
+
+  
+    <span class="summary_desc"><div class='inline'><p>
+Returns an array with the available sources.
+</p>
+</div></span>
+  
+</li>
+
+      
+        <li class="public ">
+  <span class="summary_signature">
+    
+      <a href="#current_track-instance_method" title="#current_track (instance method)">- (Hash) <strong>current_track</strong> </a>
     
 
     
     
 
     
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Iterates over every source to attempt to retrieve the current song.
+</p>
+</div></span>
   
 </li>
 
   
 </li>
 
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Disables a source.
+</p>
+</div></span>
   
 </li>
 
   
 </li>
 
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Enables a source.
+</p>
+</div></span>
+  
+</li>
+
+      
+        <li class="public ">
+  <span class="summary_signature">
+    
+      <a href="#format_sources-instance_method" title="#format_sources (instance method)">- (Array) <strong>format_sources</strong>(sources) </a>
+    
+
+    
+  </span>
+  
+  
+  
+  
+  
+  
+  
+
+  
+    <span class="summary_desc"><div class='inline'><p>
+Adds a star to all members of the array that correspond to an active
+source.
+</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 SourceManager.
+Creates a new instance of SourceManager.
 </p>
 </div></span>
   
 </p>
 </div></span>
   
@@ -228,7 +301,10 @@ A new instance of SourceManager.
   
 
   
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Resets a source.
+</p>
+</div></span>
   
 </li>
 
   
 </li>
 
@@ -262,7 +338,7 @@ A new instance of SourceManager.
 </h3><div class="docstring">
   <div class="discussion">
     <p>
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-A new instance of SourceManager
+Creates a new instance of SourceManager
 </p>
 
 
 </p>
 
 
@@ -277,10 +353,6 @@ A new instance of SourceManager
       <pre class="lines">
 
 
       <pre class="lines">
 
 
-6
-7
-8
-9
 10
 11
 12
 10
 11
 12
@@ -288,10 +360,14 @@ A new instance of SourceManager
 14
 15
 16
 14
 15
 16
-17</pre>
+17
+18
+19
+20
+21</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 6</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 10</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@enabled_sources</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
   <span class='ivar'>@enabled_sources</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
@@ -301,7 +377,7 @@ A new instance of SourceManager
       <span class='id identifier rubyid_current_source'>current_source</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
       <span class='ivar'>@enabled_sources</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_current_source'>current_source</span>
     <span class='kw'>else</span>
       <span class='id identifier rubyid_current_source'>current_source</span> <span class='op'>=</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
       <span class='ivar'>@enabled_sources</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_current_source'>current_source</span>
     <span class='kw'>else</span>
-      <span class='id identifier rubyid_raise'>raise</span> <span class='const'>StartSourceException</span>
+      <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>StartSourceError</span>
     <span class='kw'>end</span>
   <span class='kw'>end</span>
 <span class='kw'>end</span></pre>
     <span class='kw'>end</span>
   <span class='kw'>end</span>
 <span class='kw'>end</span></pre>
@@ -318,21 +394,260 @@ A new instance of SourceManager
 
     
       <div class="method_details first">
 
     
       <div class="method_details first">
-  <h3 class="signature first" id="current_track-instance_method">
+  <h3 class="signature first" id="available_sources-instance_method">
+  
+    - (<tt>Array</tt>) <strong>available_sources</strong>(format = false) 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Returns an array with the available sources. Optionally formats the result
+so active sources are identified by an appended *
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
   
   
-    - (<tt>Object</tt>) <strong>current_track</strong> 
+    <li>
+      
+        <span class='name'>format</span>
+      
+      
+        <span class='type'>(<tt>Boolean</tt>)</span>
+      
+      
+        <em class="default">(defaults to: <tt>false</tt>)</em>
+      
+      
+        &mdash;
+        <div class='inline'><p>
+whether or not to render the stars for active sources.
+</p>
+</div>
+      
+    </li>
   
   
+</ul>
 
 
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the names of the currently available sources.
+</p>
+</div>
+      
+    </li>
   
   
+</ul>
+
+</div><table class="source_code">
+  <tr>
+    <td>
+      <pre class="lines">
 
 
+
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122</pre>
+    </td>
+    <td>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 107</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
+  <span class='id identifier rubyid_path_root'>path_root</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_dirname'>dirname</span><span class='lparen'>(</span><span class='kw'>__FILE__</span><span class='rparen'>)</span><span class='rparen'>)</span>
+  <span class='id identifier rubyid_sources'>sources</span> <span class='op'>=</span> <span class='const'>Dir</span><span class='lbracket'>[</span><span class='id identifier rubyid_path_root'>path_root</span><span class='op'>+</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/sources/*.rb</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
+    <span class='id identifier rubyid_name'>name</span> <span class='op'>=</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\.rb</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
+    <span class='id identifier rubyid_name'>name</span>
+  <span class='rbrace'>}</span>
+
+  <span class='comment'># Remove arguments (Hack?) We don't want anybody to touch tihs one.
+</span>  <span class='id identifier rubyid_sources'>sources</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>arguments</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
+  <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span>
+    <span class='comment'># Add a star to denote enabled sources
+</span>    <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
+  <span class='kw'>else</span>
+    <span class='id identifier rubyid_sources'>sources</span>
+  <span class='kw'>end</span>
+<span class='kw'>end</span></pre>
+    </td>
+  </tr>
+</table>
+</div>
+    
+      <div class="method_details ">
+  <h3 class="signature " id="current_track-instance_method">
+  
+    - (<tt>Hash</tt>) <strong>current_track</strong> 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Iterates over every source to attempt to retrieve the current song.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+<p class="tag_title">Returns:</p>
+<ul class="return">
   
   
-</h3><table class="source_code">
+    <li>
+      
+      
+        <span class='type'>(<tt>Hash</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the current track, has an `:artist` and `:song` key.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
+  <tr>
+    <td>
+      <pre class="lines">
+
+
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99</pre>
+    </td>
+    <td>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 80</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
+  <span class='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='kw'>nil</span>
+  <span class='id identifier rubyid_lock'>lock</span> <span class='op'>=</span> <span class='kw'>false</span>
+  <span class='ivar'>@enabled_sources</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_source'>source</span><span class='op'>|</span>
+    <span class='kw'>begin</span>
+      <span class='id identifier rubyid_current_track'>current_track</span> <span class='op'>=</span> <span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span>
+
+      <span class='comment'># This is a special thing for arguments. The thing is, they need to
+</span>      <span class='comment'># be inputted manually. So, if they are present they won't allow
+</span>      <span class='comment'># anyone else to give results. Makes sense, yet a bit hacky.
+</span>      <span class='kw'>unless</span> <span class='id identifier rubyid_current_track'>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='op'>||</span> <span class='id identifier rubyid_current_track'>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='op'>||</span> <span class='id identifier rubyid_current_track'>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='op'>||</span> <span class='id identifier rubyid_current_track'>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='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='id identifier rubyid_current_track'>current_track</span> <span class='kw'>unless</span> <span class='id identifier rubyid_lock'>lock</span>
+        <span class='id identifier rubyid_lock'>lock</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>arguments</span><span class='tstring_end'>&quot;</span></span>
+      <span class='kw'>end</span>
+    <span class='kw'>rescue</span>
+      <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>SourceConfigurationError</span>
+    <span class='kw'>end</span>
+  <span class='kw'>end</span>
+  <span class='id identifier rubyid_track'>track</span>
+<span class='kw'>end</span></pre>
+    </td>
+  </tr>
+</table>
+</div>
+    
+      <div class="method_details ">
+  <h3 class="signature " id="disable-instance_method">
+  
+    - (<tt>Object</tt>) <strong>disable</strong>(source_name) 
+  
+
+  
+
+  
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Disables a source. This only removes the source from the `enabled_sources`
+configuration key.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>source_name</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the name of the source to disable
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
-46
 47
 48
 49
 47
 48
 49
@@ -342,21 +657,24 @@ A new instance of SourceManager
 53
 54
 55
 53
 54
 55
-56</pre>
+56
+57
+58</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 46</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 47</span>
 
 
-<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
-  <span class='id identifier rubyid_track'>track</span> <span class='op'>=</span> <span class='kw'>nil</span>
-  <span class='ivar'>@enabled_sources</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_source'>source</span><span class='op'>|</span>
-    <span class='kw'>begin</span>
-      <span class='id identifier rubyid_track'>track</span> <span class='op'>||=</span> <span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_current_track'>current_track</span>
-    <span class='kw'>rescue</span>
-      <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Source </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'> has failed to start. Please reset the source by running `</span><span class='embexpr_beg'>#{</span><span class='gvar'>$0</span><span class='rbrace'>}</span><span class='tstring_content'> source reset </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rbrace'>}</span><span class='tstring_content'>.`</span><span class='tstring_end'>&quot;</span></span>
+<span class='kw'>def</span> <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
+  <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
+    <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
+      <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
+      <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_save_config'>save_config</span>
+    <span class='kw'>else</span>
+      <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>DisableSourceError</span>
     <span class='kw'>end</span>
     <span class='kw'>end</span>
+  <span class='kw'>else</span>
+    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>UnknownSourceError</span>
   <span class='kw'>end</span>
   <span class='kw'>end</span>
-  <span class='id identifier rubyid_track'>track</span>
 <span class='kw'>end</span></pre>
     </td>
   </tr>
 <span class='kw'>end</span></pre>
     </td>
   </tr>
@@ -364,36 +682,85 @@ A new instance of SourceManager
 </div>
     
       <div class="method_details ">
 </div>
     
       <div class="method_details ">
-  <h3 class="signature " id="disable-instance_method">
+  <h3 class="signature " id="enable-instance_method">
   
   
-    - (<tt>Object</tt>) <strong>disable</strong>(source_name) 
+    - (<tt>Object</tt>) <strong>enable</strong>(source_name) 
   
 
   
 
   
   
 
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Enables a source. This runs the source&#8217;s enable method and adds it to
+the `enabled_sources` configuration key. It will only enable sources that
+are &#8220;available&#8221; (see #available_sources)
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>source_name</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the name of the source to enable
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
+28
 29
 30
 31
 32
 33
 34
 29
 30
 31
 32
 33
 34
-35</pre>
+35
+36
+37
+38
+39
+40
+41</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 29</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 28</span>
 
 
-<span class='kw'>def</span> <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
-  <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
-    <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_enable'>enable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
+  <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
+    <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
+      <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
+      <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
+      <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</span>
+      <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_save_config'>save_config</span>
+    <span class='kw'>else</span>
+      <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>EnableSourceError</span>
+    <span class='kw'>end</span>
   <span class='kw'>else</span>
   <span class='kw'>else</span>
-    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>DisableSourceException</span>
+    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>UnknownSourceError</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>
@@ -402,41 +769,87 @@ A new instance of SourceManager
 </div>
     
       <div class="method_details ">
 </div>
     
       <div class="method_details ">
-  <h3 class="signature " id="enable-instance_method">
+  <h3 class="signature " id="format_sources-instance_method">
   
   
-    - (<tt>Object</tt>) <strong>enable</strong>(source_name) 
+    - (<tt>Array</tt>) <strong>format_sources</strong>(sources) 
+  
+
   
 
   
   
 
   
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Adds a star to all members of the array that correspond to an active source
+</p>
+
 
 
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>sources</span>
+      
+      
+        <span class='type'>(<tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the array of sources to format
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the formatted array
+</p>
+</div>
+      
+    </li>
   
   
-</h3><table class="source_code">
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
-19
-20
-21
-22
-23
-24
-25
-26
-27</pre>
+129
+130
+131
+132
+133
+134</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 19</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 129</span>
 
 
-<span class='kw'>def</span> <span class='id identifier rubyid_enable'>enable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
-  <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
-    <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
-    <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
-    <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</span>
-  <span class='kw'>else</span>
-    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>EnableSourceException</span>
-  <span class='kw'>end</span>
+<span class='kw'>def</span> <span class='id identifier rubyid_format_sources'>format_sources</span><span class='lparen'>(</span><span class='id identifier rubyid_sources'>sources</span><span class='rparen'>)</span>
+  <span class='id identifier rubyid_sources'>sources</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
+    <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>*</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span>
+    <span class='id identifier rubyid_s'>s</span>
+  <span class='rbrace'>}</span>
 <span class='kw'>end</span></pre>
     </td>
   </tr>
 <span class='kw'>end</span></pre>
     </td>
   </tr>
@@ -452,30 +865,72 @@ A new instance of SourceManager
   
 
   
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Resets a source. This runs the source&#8217;s reset method. It will also
+disable them.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>source_name</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the name of the source to reset.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
   <tr>
     <td>
       <pre class="lines">
 
 
-37
-38
-39
-40
-41
-42
-43
-44</pre>
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75</pre>
     </td>
     <td>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 37</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 64</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
 
 <span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
-  <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
-    <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
-    <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
+  <span class='kw'>if</span> <span class='id identifier rubyid_available_sources'>available_sources</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
+    <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span><span class='rparen'>)</span>
+      <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
+      <span class='id identifier rubyid_disable'>disable</span><span class='lparen'>(</span><span class='id identifier rubyid_source_name'>source_name</span><span class='rparen'>)</span>
+    <span class='kw'>else</span>
+      <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>ResetSourceError</span>
+    <span class='kw'>end</span>
   <span class='kw'>else</span>
   <span class='kw'>else</span>
-    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ResetSourceException</span>
+    <span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exceptions</span><span class='op'>::</span><span class='const'>UnknownSourceError</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>
@@ -488,9 +943,9 @@ A new instance of SourceManager
 </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>