-lib/lyricli.rb 086e293fec4488ede35adbb911723c47205cdd42
-lib/lyricli/util.rb 069f80245171b855a8df437f114e6fd14a750623
-lib/lyricli/sources/rdio.rb 1a689bcee864f3f558bb4d5ee29e6a4bdb449991
-lib/lyricli/lyrics_engine.rb aa9de79d61c208533999db8604123e31f6f99b70
-lib/lyricli/configuration.rb ceebe35a6098aa48fe1f3d788f40350fcc9bf3ed
-lib/lyricli/sources/itunes.rb da39a3ee5e6b4b0d3255bfef95601890afd80709
-lib/lyricli/source_manager.rb c3d4c5bb7fec881e4edbcef97d863f1f5974e183
+lib/lyricli.rb 51e33086d1cbac6ccd601dd481a3b455376efb46
+lib/lyricli/util.rb 26284bcf3521994d5f81c5f10a750dad8fda1593
+lib/lyricli/lyricli.rb 067ba6355bce4ce18cc5552580b91b4e266250a2
+lib/lyricli/sources/rdio.rb affae043fecd57d068a54a710718d19933d53b81
+lib/lyricli/lyrics_engine.rb be6feb81f3c3c040420d1fb33df4d1282a959d15
+lib/lyricli/configuration.rb eab80327c885fe827811de01de1e9e64c312b0c0
+lib/lyricli/sources/itunes.rb 8f0b1201051be95df66f8a94554e393681795eb7
+lib/lyricli/source_manager.rb fd571d1c1a169f86efed5c886b40f912fb5ad01f
lib/lyricli/sources/arguments.rb de3b31f05d118cf00fccb41e47fd35979da9eb14
-lib/lyricli/lyricli.rb 8a5db180cd047b932626c7eea51a71715c689c1f
<title>
Module: Lyricli
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
<dt class="r1 last">Defined in:</dt>
<dd class="r1 last">lib/lyricli.rb<span class="defines">,<br />
- lib/lyricli/util.rb,<br /> lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/lyrics_engine.rb,<br /> lib/lyricli/configuration.rb,<br /> lib/lyricli/source_manager.rb,<br /> lib/lyricli/sources/arguments.rb</span>
+ lib/lyricli/util.rb,<br /> lib/lyricli/lyricli.rb,<br /> lib/lyricli/sources/rdio.rb,<br /> lib/lyricli/lyrics_engine.rb,<br /> lib/lyricli/configuration.rb,<br /> lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/source_manager.rb,<br /> lib/lyricli/sources/arguments.rb</span>
</dd>
</dl>
<div class="clear"></div>
-<h2>Defined Under Namespace</h2>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+The Lyricli module allows you to easily search for lyrics by looking for
+song and artist data from diverse sources.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><h2>Defined Under Namespace</h2>
<p class="children">
<li class="public ">
<span class="summary_signature">
- <a href="#execute-class_method" title="execute (class method)">+ (Object) <strong>execute</strong> </a>
+ <a href="#disable-class_method" title="disable (class method)">+ (Object) <strong>disable</strong>(source_name) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Disables a source via the Source Manager.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#enable-class_method" title="enable (class method)">+ (Object) <strong>enable</strong>(source_name) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Enables a source via the Source Manager.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#lyrics-class_method" title="lyrics (class method)">+ (String) <strong>lyrics</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Creates a new Lyricli instance and returns lyrics by going through the
+sources.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#reset-class_method" title="reset (class method)">+ (Object) <strong>reset</strong>(source_name) </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Resets all configuration for a source via the Source Manager.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#sources-class_method" title="sources (class method)">+ (String) <strong>sources</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Returns a list of the available sources to enable or disable.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#version-class_method" title="version (class method)">+ (String) <strong>version</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+Returns the version of the library.
+</p>
+</div></span>
</li>
<div class="method_details first">
- <h3 class="signature first" id="execute-class_method">
+ <h3 class="signature first" id="disable-class_method">
- + (<tt>Object</tt>) <strong>execute</strong>
+ + (<tt>Object</tt>) <strong>disable</strong>(source_name)
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Disables a source via the Source Manager
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+56
+57
+58
+59</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 56</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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='id identifier rubyid_source_manager'>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='id identifier rubyid_source_manager'>source_manager</span><span class='period'>.</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'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="enable-class_method">
+
+ + (<tt>Object</tt>) <strong>enable</strong>(source_name)
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Enables a source via the Source Manager
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+50
+51
+52
+53</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 50</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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='id identifier rubyid_source_manager'>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='id identifier rubyid_source_manager'>source_manager</span><span class='period'>.</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'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="lyrics-class_method">
+
+ + (<tt>String</tt>) <strong>lyrics</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Creates a new Lyricli instance and returns lyrics by going through the
+sources.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the fetched lyrics
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-29
30
31
-32</pre>
+32
+33</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 29</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 30</span>
-<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span>
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_lyrics'>lyrics</span>
<span class='ivar'>@lyricli</span> <span class='op'>=</span> <span class='const'>Lyricli</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
<span class='ivar'>@lyricli</span><span class='period'>.</span><span class='id identifier rubyid_get_lyrics'>get_lyrics</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="reset-class_method">
+
+ + (<tt>Object</tt>) <strong>reset</strong>(source_name)
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Resets all configuration for a source via the Source Manager
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+62
+63
+64
+65</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 62</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</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='id identifier rubyid_source_manager'>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='id identifier rubyid_source_manager'>source_manager</span><span class='period'>.</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'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="sources-class_method">
+
+ + (<tt>String</tt>) <strong>sources</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Returns a list of the available sources to enable or disable
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the list of available sources. Enabled sources have a star appended.
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+44
+45
+46
+47</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 44</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_sources'>sources</span>
+ <span class='id identifier rubyid_source_manager'>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='id identifier rubyid_source_manager'>source_manager</span><span class='period'>.</span><span class='id identifier rubyid_available_sources'>available_sources</span><span class='lparen'>(</span><span class='kw'>true</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>, </span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="version-class_method">
+
+ + (<tt>String</tt>) <strong>version</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Returns the version of the library
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the version
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+37
+38
+39</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli.rb', line 37</span>
+
+<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span>
+ <span class='const'>Gem</span><span class='period'>.</span><span class='id identifier rubyid_loaded_specs'>loaded_specs</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>lyricli</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_version'>version</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
</div>
</div>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Class: Lyricli::Configuration
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#delete-instance_method" title="#delete (instance method)">- (Object) <strong>delete</strong>(key) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
<span class="summary_desc"><div class='inline'></div></span>
</li>
</p>
</div></span>
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#load_config-instance_method" title="#load_config (instance method)">- (Object) <strong>load_config</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'><p>
+TODO: Apart from this, load a default yml that will be used for this.
+</p>
+</div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#save_config-instance_method" title="#save_config (instance method)">- (Object) <strong>save_config</strong> </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
</li>
4
5
6
-7</pre>
+7
+8</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 4</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@config_path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>~/.lyricli.conf</span><span class='tstring_end'>"</span></span>
<span class='ivar'>@defaults_path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>defaults.json</span><span class='tstring_end'>"</span></span>
+ <span class='ivar'>@config</span> <span class='op'>=</span> <span class='kw'>nil</span>
<span class='kw'>end</span></pre>
</td>
</tr>
<pre class="lines">
-11
12
-13</pre>
+13
+14</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 11</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 12</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
<span class='cvar'>@@instance</span>
<pre class="lines">
-15
16
17
-18</pre>
+18
+19</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 15</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 16</span>
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
<span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
<pre class="lines">
-20
21
22
23
-24</pre>
+24
+25</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 20</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 21</span>
<span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
<span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
</td>
</tr>
</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="delete-instance_method">
+
+ - (<tt>Object</tt>) <strong>delete</strong>(key)
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+27
+28
+29
+30
+31</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 27</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
+ <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_save_config'>save_config</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="load_config-instance_method">
+
+ - (<tt>Object</tt>) <strong>load_config</strong>
+
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+TODO: Apart from this, load a default yml that will be used for this. And
+just extend everything from the user’s config.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+
+
+</div><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 37</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_load_config'>load_config</span>
+ <span class='id identifier rubyid_path'>path</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='ivar'>@config_path</span><span class='rparen'>)</span>
+
+ <span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>r</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+ <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>MultiJson</span><span class='period'>.</span><span class='id identifier rubyid_decode'>decode</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='rparen'>)</span>
+ <span class='kw'>else</span>
+ <span class='id identifier rubyid_load_default_config'>load_default_config</span>
+ <span class='kw'>end</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="save_config-instance_method">
+
+ - (<tt>Object</tt>) <strong>save_config</strong>
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+48
+49
+50
+51
+52
+53</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 48</span>
+
+<span class='kw'>def</span> <span class='id identifier rubyid_save_config'>save_config</span>
+ <span class='id identifier rubyid_path'>path</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='ivar'>@config_path</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>w</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_print'>print</span><span class='lparen'>(</span><span class='const'>MultiJson</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='rparen'>)</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
+<span class='kw'>end</span></pre>
+ </td>
+ </tr>
+</table>
</div>
</div>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Class: Lyricli::Lyricli
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
<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>
<pre class="lines">
-36
-37
-38</pre>
+4
+5
+6</pre>
</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 4</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>
<pre class="lines">
-61
-62
-63
-64</pre>
+29
+30
+31
+32</pre>
</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 29</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'>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>
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+
+
+ </div>
+</div>
+<div class="tags">
+
+<p class="tag_title">Raises:</p>
+<ul class="raise">
+
+ <li>
+
+
+ <span class='type'>(<tt>InvalidLyrics</tt>)</span>
+
+
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-40
-41
-42</pre>
+8
+9
+10</pre>
</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 8</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'>"</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'>"</span></span>
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidLyrics</span>
<span class='kw'>end</span></pre>
</td>
</tr>
<pre class="lines">
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55</pre>
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23</pre>
</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 12</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>
<pre class="lines">
-57
-58
-59</pre>
+25
+26
+27</pre>
</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 25</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>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Class: Lyricli::LyricsEngine
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Class: Lyricli::SourceManager
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
<li class="public ">
<span class="summary_signature">
+ <a href="#available_sources-instance_method" title="#available_sources (instance method)">- (Object) <strong>available_sources</strong>(format = false) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
<a href="#current_track-instance_method" title="#current_track (instance method)">- (Object) <strong>current_track</strong> </a>
+ <span class="summary_desc"><div class='inline'></div></span>
+
+</li>
+
+
+ <li class="public ">
+ <span class="summary_signature">
+
+ <a href="#format_sources-instance_method" title="#format_sources (instance method)">- (Object) <strong>format_sources</strong>(sources) </a>
+
+
+
+ </span>
+
+
+
+
+
+
+
+
+
<span class="summary_desc"><div class='inline'></div></span>
</li>
<div class="method_details first">
- <h3 class="signature first" id="current_track-instance_method">
+ <h3 class="signature first" id="available_sources-instance_method">
+
+ - (<tt>Object</tt>) <strong>available_sources</strong>(format = false)
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 81</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'>"</span><span class='tstring_content'>/sources/*.rb</span><span class='tstring_end'>"</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'>"</span><span class='tstring_content'>/</span><span class='tstring_end'>"</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'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+
+ <span class='comment'># Add a star to denote enabled sources
+</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'>"</span><span class='tstring_content'>arguments</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+ <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</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>Object</tt>) <strong>current_track</strong>
<pre class="lines">
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56</pre>
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79</pre>
</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 60</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_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='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'>"</span><span class='tstring_content'>arguments</span><span class='tstring_end'>"</span></span>
+ <span class='kw'>end</span>
<span class='kw'>rescue</span>
- <span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</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'>"</span></span>
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>SourceConfigurationException</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_track'>track</span>
<pre class="lines">
-29
-30
-31
-32
-33
34
-35</pre>
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45</pre>
</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 34</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'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</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'>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'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</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'>DisableSourceException</span>
+ <span class='kw'>end</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'>UnknownSource</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
24
25
26
-27</pre>
+27
+28
+29
+30
+31
+32</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 19</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'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'><<</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'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</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'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'><<</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'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</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'>EnableSourceException</span>
+ <span class='kw'>end</span>
<span class='kw'>else</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>EnableSourceException</span>
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>UnknownSource</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
+</div>
+
+ <div class="method_details ">
+ <h3 class="signature " id="format_sources-instance_method">
+
+ - (<tt>Object</tt>) <strong>format_sources</strong>(sources)
+
+
+
+
+
+</h3><table class="source_code">
+ <tr>
+ <td>
+ <pre class="lines">
+
+
+99
+100
+101
+102
+103
+104</pre>
+ </td>
+ <td>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/source_manager.rb', line 99</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'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>*</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>enabled_sources</span><span class='tstring_end'>"</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>
+</table>
</div>
<div class="method_details ">
<pre class="lines">
-37
-38
-39
-40
-41
-42
-43
-44</pre>
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58</pre>
</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 47</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'>ResetSourceException</span>
+ <span class='kw'>end</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'>UnknownSource</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Module: Lyricli::Sources
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
<dt class="r1 last">Defined in:</dt>
<dd class="r1 last">lib/lyricli/sources/rdio.rb<span class="defines">,<br />
- lib/lyricli/sources/arguments.rb</span>
+ lib/lyricli/sources/itunes.rb,<br /> lib/lyricli/sources/arguments.rb</span>
</dd>
</dl>
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span>, <span class='object_link'><a href="Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span>
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span>, <span class='object_link'><a href="Sources/Itunes.html" title="Lyricli::Sources::Itunes (class)">Itunes</a></span>, <span class='object_link'><a href="Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span>
</p>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Class: Lyricli::Sources::Arguments
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
<span id="name=-class_method"></span>
- <span id="name-class_method"></span>
<div class="method_details first">
<h3 class="signature first" id="name-class_method">
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:15 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Class: Lyricli::Sources::Rdio
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
<pre class="lines">
-23
-24
-25
-26
-27</pre>
+27
+28
+29
+30
+31</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 23</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 27</span>
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rdio</span><span class='tstring_end'>'</span></span>
- <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Lyricli</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
- <span class='ivar'>@rdio</span> <span class='op'>=</span> <span class='const'>Rdio</span><span class='op'>::</span><span class='const'>SimpleRdio</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_key</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_secret</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
+ <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
+ <span class='ivar'>@rdio</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Rdio</span><span class='op'>::</span><span class='const'>SimpleRdio</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_key</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_secret</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
<span id="name=-class_method"></span>
- <span id="name-class_method"></span>
<div class="method_details first">
<h3 class="signature first" id="name-class_method">
<pre class="lines">
-46
-47
-48
-49
-50
51
52
53
59
60
61
-62</pre>
+62
+63
+64
+65
+66
+67</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 46</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 51</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_create_auth_token'>create_auth_token</span>
- <span class='ivar'>@rdio</span> <span class='op'>=</span> <span class='const'>Rdio</span><span class='op'>::</span><span class='const'>SimpleRdio</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_key</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_secret</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
+ <span class='id identifier rubyid_rdio'>rdio</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Rdio</span><span class='op'>::</span><span class='const'>SimpleRdio</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_key</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_secret</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
<span class='comment'># Request Authorization
</span> <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Follow this URL to authorize lyricli:</span><span class='tstring_end'>"</span></span>
<span class='id identifier rubyid_auth_url'>auth_url</span> <span class='op'>=</span> <span class='id identifier rubyid_rdio'>rdio</span><span class='period'>.</span><span class='id identifier rubyid_begin_authentication'>begin_authentication</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>oob</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_auth_url'>auth_url</span>
- <span class='const'>Launchy</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_auth_url'>auth_url</span><span class='rparen'>)</span>
+ <span class='op'>::</span><span class='const'>Launchy</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_auth_url'>auth_url</span><span class='rparen'>)</span>
<span class='comment'># Request Code, Obtain Token
</span> <span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Please type the authorization code: </span><span class='tstring_end'>"</span></span>
17
18
19
-20</pre>
+20
+21
+22
+23
+24</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 13</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_enable'>enable</span>
<span class='comment'># Validation Code
-</span> <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Lyricli</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
+</span> <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
<span class='kw'>unless</span> <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='op'>!</span><span class='ivar'>@config</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
<span class='id identifier rubyid_create_auth_token'>create_auth_token</span>
<span class='kw'>end</span>
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>***</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Hello, rdio tends to be a bit aggressive and tends to have trouble with other sources. If you're having trouble, you can disable it temporarily. You will not have to reauthenticate.</span><span class='tstring_end'>"</span></span>
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>***</span><span class='tstring_end'>"</span></span>
+
<span class='kw'>end</span></pre>
</td>
</tr>
<pre class="lines">
-40
-41
-42</pre>
+44
+45
+46
+47</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 40</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 44</span>
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_reset'>reset</span>
- <span class='comment'># Reset Code
-</span><span class='kw'>end</span></pre>
+ <span class='ivar'>@config</span> <span class='op'>=</span> <span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
+ <span class='ivar'>@config</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>rdio_auth_token</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
+<span class='kw'>end</span></pre>
</td>
</tr>
</table>
<pre class="lines">
-32
-33
-34
-35
36
-37</pre>
+37
+38
+39
+40
+41</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 32</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/sources/rdio.rb', line 36</span>
<span class='kw'>def</span> <span class='id identifier rubyid_current_track'>current_track</span>
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='ivar'>@rdio</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>currentUser</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>extras</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>lastSongPlayed</span><span class='tstring_end'>'</span></span><span class='rbrace'>}</span><span class='rparen'>)</span>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<title>
Module: Lyricli::Util
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
</dl>
<div class="clear"></div>
+<h2>Overview</h2><div class="docstring">
+ <div class="discussion">
+ <p>
+This module contains several utility functions.
+</p>
+ </div>
+</div>
+<div class="tags">
+
+
+</div>
+
<li class="public ">
<span class="summary_signature">
- <a href="#camelize-instance_method" title="#camelize (instance method)">- (Object) <strong>camelize</strong>(str) </a>
+ <a href="#camelize-instance_method" title="#camelize (instance method)">- (String) <strong>camelize</strong>(str) </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Transforms a string from snake_case to UpperCamelCase.
+</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#parse_class-instance_method" title="#parse_class (instance method)">- (Object) <strong>parse_class</strong>(class_name) </a>
+ <a href="#parse_class-instance_method" title="#parse_class (instance method)">- (Class<sup>?</sup>) <strong>parse_class</strong>(class_name) </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Takes a class name in snake_case and attempts to find the corresponding
+class from the sources.
+</p>
+</div></span>
</li>
<li class="public ">
<span class="summary_signature">
- <a href="#sanitize_param-instance_method" title="#sanitize_param (instance method)">- (Object) <strong>sanitize_param</strong>(p) </a>
+ <a href="#sanitize_param-instance_method" title="#sanitize_param (instance method)">- (String) <strong>sanitize_param</strong>(p) </a>
- <span class="summary_desc"><div class='inline'></div></span>
+ <span class="summary_desc"><div class='inline'><p>
+Simply escapes a param and substitutes spaces and escaped plus signs for
+plus signs.
+</p>
+</div></span>
</li>
<div class="method_details first">
<h3 class="signature first" id="camelize-instance_method">
- - (<tt>Object</tt>) <strong>camelize</strong>(str)
+ - (<tt>String</tt>) <strong>camelize</strong>(str)
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Transforms a string from snake_case to UpperCamelCase
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>str</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the string that will be Camelized
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the Camelized string.
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-3
-4
-5</pre>
+9
+10
+11</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 3</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 9</span>
<span class='kw'>def</span> <span class='id identifier rubyid_camelize'>camelize</span><span class='lparen'>(</span><span class='id identifier rubyid_str'>str</span><span class='rparen'>)</span>
<span class='id identifier rubyid_str'>str</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_</span><span class='tstring_end'>'</span></span><span class='rparen'>)</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_w'>w</span><span class='op'>|</span> <span class='id identifier rubyid_w'>w</span><span class='period'>.</span><span class='id identifier rubyid_capitalize'>capitalize</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
<div class="method_details ">
<h3 class="signature " id="parse_class-instance_method">
- - (<tt>Object</tt>) <strong>parse_class</strong>(class_name)
+ - (<tt>Class</tt><sup>?</sup>) <strong>parse_class</strong>(class_name)
-</h3><table class="source_code">
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Takes a class name in snake_case and attempts to find the corresponding
+class from the sources.
+</p>
+
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+
+ <li>
+
+ <span class='name'>class_name</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the snake_case name of the class to search for.
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>Class</tt>, <tt>nil</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the found class or nil
+</p>
+</div>
+
+ </li>
+
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-7
-8
-9
-10
-11
-12
-13
-14</pre>
+18
+19
+20
+21
+22
+23
+24
+25</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 7</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 18</span>
<span class='kw'>def</span> <span class='id identifier rubyid_parse_class'>parse_class</span><span class='lparen'>(</span><span class='id identifier rubyid_class_name'>class_name</span><span class='rparen'>)</span>
<span class='kw'>begin</span>
<div class="method_details ">
<h3 class="signature " id="sanitize_param-instance_method">
- - (<tt>Object</tt>) <strong>sanitize_param</strong>(p)
+ - (<tt>String</tt>) <strong>sanitize_param</strong>(p)
+
+
+
+
+</h3><div class="docstring">
+ <div class="discussion">
+ <p>
+Simply escapes a param and substitutes spaces and escaped plus signs for
+plus signs.
+</p>
+
+ </div>
+</div>
+<div class="tags">
+ <p class="tag_title">Parameters:</p>
+<ul class="param">
+ <li>
+
+ <span class='name'>p</span>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the parameter to be sanitized
+</p>
+</div>
+
+ </li>
+
+</ul>
+<p class="tag_title">Returns:</p>
+<ul class="return">
+
+ <li>
+
+
+ <span class='type'>(<tt>String</tt>)</span>
+
+
+
+ —
+ <div class='inline'><p>
+the sanitized parameter
+</p>
+</div>
+
+ </li>
-</h3><table class="source_code">
+</ul>
+
+</div><table class="source_code">
<tr>
<td>
<pre class="lines">
-16
-17
-18</pre>
+32
+33
+34</pre>
</td>
<td>
- <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 16</span>
+ <pre class="code"><span class="info file"># File 'lib/lyricli/util.rb', line 32</span>
<span class='kw'>def</span> <span class='id identifier rubyid_sanitize_param'>sanitize_param</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='rparen'>)</span>
<span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_encode_www_form_component'>encode_www_form_component</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</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'> </span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>+</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%2B</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>+</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
- Documentation by YARD 0.8.1
+ Documentation by YARD 0.8.2.1
</title>
<iframe id="search_frame"></iframe>
- <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.1</h1>
+ <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.2.1</h1>
<div id="listing">
<h1 class="alphaindex">Alphabetic Index</h1>
+ <h2>File Listing</h2>
+ <ul id="files" class="index_inline_list">
+
+
+ <li class="r1"><a href="index.html" title="README">README</a></li>
+
+
+ </ul>
+
<div class="clear"></div>
<h2>Namespace Listing A-Z</h2>
</ul>
- <ul id="alpha_L" class="alpha">
- <li class="letter">L</li>
+ <ul id="alpha_I" class="alpha">
+ <li class="letter">I</li>
<ul>
<li>
- <span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span>
+ <span class='object_link'><a href="Lyricli/Sources/Itunes.html" title="Lyricli::Sources::Itunes (class)">Itunes</a></span>
- <small>(Lyricli)</small>
+ <small>(Lyricli::Sources)</small>
</li>
+ </ul>
+ </ul>
+
+
+ <ul id="alpha_L" class="alpha">
+ <li class="letter">L</li>
+ <ul>
+
<li>
<span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span>
</li>
+ <li>
+ <span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span>
+
+ <small>(Lyricli)</small>
+
+ </li>
+
<li>
<span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:50 2012 by
<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>
<ul id="full_list" class="class">
<li><span class='object_link'><a href="top-level-namespace.html" title=" (root)">Top Level Namespace</a></span></li>
-<li><a class='toggle'></a> <span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lyricli/Configuration.html" title="Lyricli::Configuration (class)">Configuration</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span> < Object<small class='search_info'>Lyricli</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span><small class='search_info'>Lyricli</small></li><ul><li><span class='object_link'><a href="Lyricli/Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li></ul><li><span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span><small class='search_info'>Lyricli</small></li></ul>
+<li><a class='toggle'></a> <span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span><small class='search_info'>Top Level Namespace</small></li><ul><li><span class='object_link'><a href="Lyricli/Configuration.html" title="Lyricli::Configuration (class)">Configuration</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span> < Object<small class='search_info'>Lyricli</small></li><li><span class='object_link'><a href="Lyricli/SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span> < Object<small class='search_info'>Lyricli</small></li><li><a class='toggle'></a> <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span><small class='search_info'>Lyricli</small></li><ul><li><span class='object_link'><a href="Lyricli/Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Itunes.html" title="Lyricli::Sources::Itunes (class)">Itunes</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li><li><span class='object_link'><a href="Lyricli/Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span> < Object<small class='search_info'>Lyricli::Sources</small></li></ul><li><span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span><small class='search_info'>Lyricli</small></li></ul>
</ul>
</div>
<ul id="full_list" class="file">
+ <li class="r1"><a href="index.html" title="README">README</a></li>
+
+
</ul>
</div>
</body>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
- <title>Documentation by YARD 0.8.1</title>
+ <title>Documentation by YARD 0.8.2.1</title>
</head>
<script type="text/javascript" charset="utf-8">
window.onload = function() {
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>
- Documentation by YARD 0.8.1
+ File: README
+
+ — Documentation by YARD 0.8.2.1
</title>
<div id="header">
<div id="menu">
+ <a href="_index.html">Index</a> »
+ <span class="title">File: README</span>
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<iframe id="search_frame"></iframe>
- <div id="content"><h1 class="noborder title">Documentation by YARD 0.8.1</h1>
-<div id="listing">
- <h1 class="alphaindex">Alphabetic Index</h1>
-
-<div class="clear"></div>
-<h2>Namespace Listing A-Z</h2>
-
-
-
-
-<table>
- <tr>
- <td valign='top' width="33%">
-
-
- <ul id="alpha_A" class="alpha">
- <li class="letter">A</li>
- <ul>
-
- <li>
- <span class='object_link'><a href="Lyricli/Sources/Arguments.html" title="Lyricli::Sources::Arguments (class)">Arguments</a></span>
-
- <small>(Lyricli::Sources)</small>
-
- </li>
-
- </ul>
- </ul>
-
-
- <ul id="alpha_C" class="alpha">
- <li class="letter">C</li>
- <ul>
-
- <li>
- <span class='object_link'><a href="Lyricli/Configuration.html" title="Lyricli::Configuration (class)">Configuration</a></span>
-
- <small>(Lyricli)</small>
-
- </li>
-
- </ul>
- </ul>
-
-
- <ul id="alpha_L" class="alpha">
- <li class="letter">L</li>
- <ul>
-
- <li>
- <span class='object_link'><a href="Lyricli/Lyricli.html" title="Lyricli::Lyricli (class)">Lyricli</a></span>
-
- <small>(Lyricli)</small>
-
- </li>
-
- <li>
- <span class='object_link'><a href="Lyricli.html" title="Lyricli (module)">Lyricli</a></span>
-
- </li>
-
- <li>
- <span class='object_link'><a href="Lyricli/LyricsEngine.html" title="Lyricli::LyricsEngine (class)">LyricsEngine</a></span>
-
- <small>(Lyricli)</small>
-
- </li>
-
- </ul>
- </ul>
-
-
- <ul id="alpha_R" class="alpha">
- <li class="letter">R</li>
- <ul>
-
- <li>
- <span class='object_link'><a href="Lyricli/Sources/Rdio.html" title="Lyricli::Sources::Rdio (class)">Rdio</a></span>
-
- <small>(Lyricli::Sources)</small>
-
- </li>
-
- </ul>
- </ul>
-
-
- <ul id="alpha_S" class="alpha">
- <li class="letter">S</li>
- <ul>
-
- <li>
- <span class='object_link'><a href="Lyricli/SourceManager.html" title="Lyricli::SourceManager (class)">SourceManager</a></span>
-
- <small>(Lyricli)</small>
-
- </li>
-
- <li>
- <span class='object_link'><a href="Lyricli/Sources.html" title="Lyricli::Sources (module)">Sources</a></span>
-
- <small>(Lyricli)</small>
-
- </li>
-
- </ul>
- </ul>
-
-
- <ul id="alpha_U" class="alpha">
- <li class="letter">U</li>
- <ul>
-
- <li>
- <span class='object_link'><a href="Lyricli/Util.html" title="Lyricli::Util (module)">Util</a></span>
-
- <small>(Lyricli)</small>
-
- </li>
-
- </ul>
- </ul>
-
- </td>
- </tr>
-</table>
+ <div id="content"><div id='filecontents'><h1>Lyricli</h1>
-</div>
+<h2>The command line client for lyrics</h2>
-</div>
+<p>This is a quick introduction for Lyricli. Right now it's in really early
+stages of development, so it's lacking in a lot of stuff (mainly tests
+and documentation) ... But it generally works and here's a tutorial to
+see how to get it working.</p>
+
+<h3>Installing</h3>
+
+<ol>
+<li>Clone this Repo</li>
+<li><code>gem build lyricli.gemspec</code></li>
+<li><code>gem install lyricli-0.0.1.gem</code></li>
+<li>Voila!</li>
+</ol>
+
+<h3>Usage</h3>
+
+<p>Lyricli can be invoked with the command <code>lrc</code> and there are three basic
+ways of using it:</p>
+
+<p><code>lrc</code></p>
+
+<p>When you run it without arguments, it will look in the available sources
+to try to find a playing song and extract the lyrics.</p>
+
+<p><code>lrc artist song</code></p>
+
+<p>When you run it with arguments, it will use them to search for the
+lyrics. This won't work if you manually disable the arguments source in
+your configuration file.</p>
+
+<h4>Commands</h4>
+
+<p>The third way to use it is by passing it one of the following special
+commands:</p>
+
+<ul>
+<li><code>lrc -l</code> or <code>lrc --list-sources</code> lists the available sources.</li>
+<li><code>lrc -e</code> or <code>lrc --enable SOURCE</code> enable a source from the list.</li>
+<li><code>lrc -d</code> or <code>lrc --disable SOURCE</code> disable a source from the list.</li>
+<li><code>lrc -r</code> or <code>lrc --reset SOURCE</code> reset all configuration for a source.</li>
+<li><code>lrc -v</code> or <code>lrc --version</code> show the installed version of lyricli.</li>
+<li><code>lrc -h</code> or <code>lrc --help</code> display some help</li>
+</ul>
+
+<h3>Roadmap</h3>
+
+<p>There is not much defined right now as a roadmap, but this needs to be
+done:</p>
+
+<ul>
+<li>Specs for all the components</li>
+<li>YARD documentation for all the components</li>
+</ul>
+
+<p>And the first thing I want to work on after that is done is separating
+the Lyrics Engines so we can add/remove lyrics engines in a similar way to how
+we currently add/remove sources.</p>
+
+<h3>Leave Feedback Please!</h3>
+
+<p>If you decide to use or hack away at Lyricly, please don't forget to
+post any issues you find.</p>
+
+<h3>License</h3>
+
+<p>Licensed under 3-clause-BSD.</p>
+</div></div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:50 2012 by
<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>
function summaryToggle() {
$('.summary_toggle').click(function() {
- localStorage.summaryCollapsed = $(this).text();
- $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
- var next = $(this).parent().parent().nextAll('ul.summary').first();
- if (next.hasClass('compact')) {
- next.toggle();
- next.nextAll('ul.summary').first().toggle();
- }
- else if (next.hasClass('summary')) {
- var list = $('<ul class="summary compact" />');
- list.html(next.html());
- list.find('.summary_desc, .note').remove();
- list.find('a').each(function() {
- $(this).html($(this).find('strong').html());
- $(this).parent().html($(this)[0].outerHTML);
- });
- next.before(list);
- next.toggle();
+ if (localStorage) {
+ localStorage.summaryCollapsed = $(this).text();
}
+ $('.summary_toggle').each(function() {
+ $(this).text($(this).text() == "collapse" ? "expand" : "collapse");
+ var next = $(this).parent().parent().nextAll('ul.summary').first();
+ if (next.hasClass('compact')) {
+ next.toggle();
+ next.nextAll('ul.summary').first().toggle();
+ }
+ else if (next.hasClass('summary')) {
+ var list = $('<ul class="summary compact" />');
+ list.html(next.html());
+ list.find('.summary_desc, .note').remove();
+ list.find('a').each(function() {
+ $(this).html($(this).find('strong').html());
+ $(this).parent().html($(this)[0].outerHTML);
+ });
+ next.before(list);
+ next.toggle();
+ }
+ });
return false;
});
if (localStorage) {
- if (localStorage.summaryCollapsed == "collapse") $('.summary_toggle').click();
+ if (localStorage.summaryCollapsed == "collapse") {
+ $('.summary_toggle').first().click();
+ }
else localStorage.summaryCollapsed = "expand";
}
}
<li class="r1 ">
+ <span class='object_link'><a href="Lyricli/SourceManager.html#available_sources-instance_method" title="Lyricli::SourceManager#available_sources (method)">#available_sources</a></span>
+
+ <small>Lyricli::SourceManager</small>
+
+ </li>
+
+
+ <li class="r2 ">
<span class='object_link'><a href="Lyricli/Util.html#camelize-instance_method" title="Lyricli::Util#camelize (method)">#camelize</a></span>
<small>Lyricli::Util</small>
</li>
- <li class="r2 ">
+ <li class="r1 ">
<span class='object_link'><a href="Lyricli/Lyricli.html#check_params-instance_method" title="Lyricli::Lyricli#check_params (method)">#check_params</a></span>
<small>Lyricli::Lyricli</small>
</li>
- <li class="r1 ">
+ <li class="r2 ">
<span class='object_link'><a href="Lyricli/Sources/Rdio.html#create_auth_token-class_method" title="Lyricli::Sources::Rdio.create_auth_token (method)">create_auth_token</a></span>
<small>Lyricli::Sources::Rdio</small>
</li>
+ <li class="r1 ">
+ <span class='object_link'><a href="Lyricli/Sources/Rdio.html#current_track-instance_method" title="Lyricli::Sources::Rdio#current_track (method)">#current_track</a></span>
+
+ <small>Lyricli::Sources::Rdio</small>
+
+ </li>
+
+
<li class="r2 ">
<span class='object_link'><a href="Lyricli/Sources/Arguments.html#current_track-instance_method" title="Lyricli::Sources::Arguments#current_track (method)">#current_track</a></span>
<li class="r1 ">
- <span class='object_link'><a href="Lyricli/SourceManager.html#current_track-instance_method" title="Lyricli::SourceManager#current_track (method)">#current_track</a></span>
+ <span class='object_link'><a href="Lyricli/Sources/Itunes.html#current_track-instance_method" title="Lyricli::Sources::Itunes#current_track (method)">#current_track</a></span>
- <small>Lyricli::SourceManager</small>
+ <small>Lyricli::Sources::Itunes</small>
</li>
<li class="r2 ">
- <span class='object_link'><a href="Lyricli/Sources/Rdio.html#current_track-instance_method" title="Lyricli::Sources::Rdio#current_track (method)">#current_track</a></span>
+ <span class='object_link'><a href="Lyricli/SourceManager.html#current_track-instance_method" title="Lyricli::SourceManager#current_track (method)">#current_track</a></span>
- <small>Lyricli::Sources::Rdio</small>
+ <small>Lyricli::SourceManager</small>
</li>
<li class="r1 ">
+ <span class='object_link'><a href="Lyricli/Configuration.html#delete-instance_method" title="Lyricli::Configuration#delete (method)">#delete</a></span>
+
+ <small>Lyricli::Configuration</small>
+
+ </li>
+
+
+ <li class="r2 ">
<span class='object_link'><a href="Lyricli/SourceManager.html#disable-instance_method" title="Lyricli::SourceManager#disable (method)">#disable</a></span>
<small>Lyricli::SourceManager</small>
</li>
+ <li class="r1 ">
+ <span class='object_link'><a href="Lyricli.html#disable-class_method" title="Lyricli.disable (method)">disable</a></span>
+
+ <small>Lyricli</small>
+
+ </li>
+
+
<li class="r2 ">
- <span class='object_link'><a href="Lyricli/SourceManager.html#enable-instance_method" title="Lyricli::SourceManager#enable (method)">#enable</a></span>
+ <span class='object_link'><a href="Lyricli/Sources/Itunes.html#enable-class_method" title="Lyricli::Sources::Itunes.enable (method)">enable</a></span>
- <small>Lyricli::SourceManager</small>
+ <small>Lyricli::Sources::Itunes</small>
</li>
<li class="r2 ">
- <span class='object_link'><a href="Lyricli/Sources/Rdio.html#enable-class_method" title="Lyricli::Sources::Rdio.enable (method)">enable</a></span>
+ <span class='object_link'><a href="Lyricli.html#enable-class_method" title="Lyricli.enable (method)">enable</a></span>
- <small>Lyricli::Sources::Rdio</small>
+ <small>Lyricli</small>
</li>
<li class="r1 ">
- <span class='object_link'><a href="Lyricli.html#execute-class_method" title="Lyricli.execute (method)">execute</a></span>
+ <span class='object_link'><a href="Lyricli/SourceManager.html#enable-instance_method" title="Lyricli::SourceManager#enable (method)">#enable</a></span>
- <small>Lyricli</small>
+ <small>Lyricli::SourceManager</small>
</li>
<li class="r2 ">
+ <span class='object_link'><a href="Lyricli/Sources/Rdio.html#enable-class_method" title="Lyricli::Sources::Rdio.enable (method)">enable</a></span>
+
+ <small>Lyricli::Sources::Rdio</small>
+
+ </li>
+
+
+ <li class="r1 ">
<span class='object_link'><a href="Lyricli/Lyricli.html#exit_with_error-instance_method" title="Lyricli::Lyricli#exit_with_error (method)">#exit_with_error</a></span>
<small>Lyricli::Lyricli</small>
</li>
+ <li class="r2 ">
+ <span class='object_link'><a href="Lyricli/SourceManager.html#format_sources-instance_method" title="Lyricli::SourceManager#format_sources (method)">#format_sources</a></span>
+
+ <small>Lyricli::SourceManager</small>
+
+ </li>
+
+
<li class="r1 ">
<span class='object_link'><a href="Lyricli/Lyricli.html#get_lyrics-instance_method" title="Lyricli::Lyricli#get_lyrics (method)">#get_lyrics</a></span>
<li class="r1 ">
- <span class='object_link'><a href="Lyricli/SourceManager.html#initialize-instance_method" title="Lyricli::SourceManager#initialize (method)">#initialize</a></span>
+ <span class='object_link'><a href="Lyricli/Sources/Rdio.html#initialize-instance_method" title="Lyricli::Sources::Rdio#initialize (method)">#initialize</a></span>
- <small>Lyricli::SourceManager</small>
+ <small>Lyricli::Sources::Rdio</small>
</li>
<li class="r2 ">
- <span class='object_link'><a href="Lyricli/Configuration.html#initialize-instance_method" title="Lyricli::Configuration#initialize (method)">#initialize</a></span>
+ <span class='object_link'><a href="Lyricli/SourceManager.html#initialize-instance_method" title="Lyricli::SourceManager#initialize (method)">#initialize</a></span>
- <small>Lyricli::Configuration</small>
+ <small>Lyricli::SourceManager</small>
</li>
<li class="r1 ">
- <span class='object_link'><a href="Lyricli/Sources/Arguments.html#initialize-instance_method" title="Lyricli::Sources::Arguments#initialize (method)">#initialize</a></span>
+ <span class='object_link'><a href="Lyricli/Configuration.html#initialize-instance_method" title="Lyricli::Configuration#initialize (method)">#initialize</a></span>
- <small>Lyricli::Sources::Arguments</small>
+ <small>Lyricli::Configuration</small>
</li>
<li class="r1 ">
- <span class='object_link'><a href="Lyricli/Sources/Rdio.html#initialize-instance_method" title="Lyricli::Sources::Rdio#initialize (method)">#initialize</a></span>
+ <span class='object_link'><a href="Lyricli/LyricsEngine.html#initialize-instance_method" title="Lyricli::LyricsEngine#initialize (method)">#initialize</a></span>
- <small>Lyricli::Sources::Rdio</small>
+ <small>Lyricli::LyricsEngine</small>
</li>
<li class="r2 ">
- <span class='object_link'><a href="Lyricli/LyricsEngine.html#initialize-instance_method" title="Lyricli::LyricsEngine#initialize (method)">#initialize</a></span>
+ <span class='object_link'><a href="Lyricli/Sources/Itunes.html#initialize-instance_method" title="Lyricli::Sources::Itunes#initialize (method)">#initialize</a></span>
- <small>Lyricli::LyricsEngine</small>
+ <small>Lyricli::Sources::Itunes</small>
</li>
<li class="r1 ">
+ <span class='object_link'><a href="Lyricli/Sources/Arguments.html#initialize-instance_method" title="Lyricli::Sources::Arguments#initialize (method)">#initialize</a></span>
+
+ <small>Lyricli::Sources::Arguments</small>
+
+ </li>
+
+
+ <li class="r2 ">
<span class='object_link'><a href="Lyricli/Configuration.html#instance-class_method" title="Lyricli::Configuration.instance (method)">instance</a></span>
<small>Lyricli::Configuration</small>
</li>
+ <li class="r1 ">
+ <span class='object_link'><a href="Lyricli/Configuration.html#load_config-instance_method" title="Lyricli::Configuration#load_config (method)">#load_config</a></span>
+
+ <small>Lyricli::Configuration</small>
+
+ </li>
+
+
<li class="r2 ">
+ <span class='object_link'><a href="Lyricli.html#lyrics-class_method" title="Lyricli.lyrics (method)">lyrics</a></span>
+
+ <small>Lyricli</small>
+
+ </li>
+
+
+ <li class="r1 ">
<span class='object_link'><a href="Lyricli/Sources/Rdio.html#name-class_method" title="Lyricli::Sources::Rdio.name (method)">name</a></span>
<small>Lyricli::Sources::Rdio</small>
</li>
- <li class="r1 ">
+ <li class="r2 ">
<span class='object_link'><a href="Lyricli/Sources/Arguments.html#name-class_method" title="Lyricli::Sources::Arguments.name (method)">name</a></span>
<small>Lyricli::Sources::Arguments</small>
</li>
+ <li class="r1 ">
+ <span class='object_link'><a href="Lyricli/Sources/Itunes.html#name-class_method" title="Lyricli::Sources::Itunes.name (method)">name</a></span>
+
+ <small>Lyricli::Sources::Itunes</small>
+
+ </li>
+
+
<li class="r2 ">
<span class='object_link'><a href="Lyricli/Util.html#parse_class-instance_method" title="Lyricli::Util#parse_class (method)">#parse_class</a></span>
<li class="r1 ">
+ <span class='object_link'><a href="Lyricli/Sources/Rdio.html#reset-class_method" title="Lyricli::Sources::Rdio.reset (method)">reset</a></span>
+
+ <small>Lyricli::Sources::Rdio</small>
+
+ </li>
+
+
+ <li class="r2 ">
<span class='object_link'><a href="Lyricli/SourceManager.html#reset-instance_method" title="Lyricli::SourceManager#reset (method)">#reset</a></span>
<small>Lyricli::SourceManager</small>
</li>
+ <li class="r1 ">
+ <span class='object_link'><a href="Lyricli.html#reset-class_method" title="Lyricli.reset (method)">reset</a></span>
+
+ <small>Lyricli</small>
+
+ </li>
+
+
<li class="r2 ">
- <span class='object_link'><a href="Lyricli/Sources/Arguments.html#reset-class_method" title="Lyricli::Sources::Arguments.reset (method)">reset</a></span>
+ <span class='object_link'><a href="Lyricli/Sources/Itunes.html#reset-class_method" title="Lyricli::Sources::Itunes.reset (method)">reset</a></span>
- <small>Lyricli::Sources::Arguments</small>
+ <small>Lyricli::Sources::Itunes</small>
</li>
<li class="r1 ">
- <span class='object_link'><a href="Lyricli/Sources/Rdio.html#reset-class_method" title="Lyricli::Sources::Rdio.reset (method)">reset</a></span>
+ <span class='object_link'><a href="Lyricli/Sources/Arguments.html#reset-class_method" title="Lyricli::Sources::Arguments.reset (method)">reset</a></span>
- <small>Lyricli::Sources::Rdio</small>
+ <small>Lyricli::Sources::Arguments</small>
</li>
<li class="r1 ">
+ <span class='object_link'><a href="Lyricli/Configuration.html#save_config-instance_method" title="Lyricli::Configuration#save_config (method)">#save_config</a></span>
+
+ <small>Lyricli::Configuration</small>
+
+ </li>
+
+
+ <li class="r2 ">
<span class='object_link'><a href="Lyricli/Lyricli.html#set_current_track-instance_method" title="Lyricli::Lyricli#set_current_track (method)">#set_current_track</a></span>
<small>Lyricli::Lyricli</small>
</li>
+ <li class="r1 ">
+ <span class='object_link'><a href="Lyricli.html#sources-class_method" title="Lyricli.sources (method)">sources</a></span>
+
+ <small>Lyricli</small>
+
+ </li>
+
+
+ <li class="r2 ">
+ <span class='object_link'><a href="Lyricli.html#version-class_method" title="Lyricli.version (method)">version</a></span>
+
+ <small>Lyricli</small>
+
+ </li>
+
+
</ul>
</div>
</body>
<title>
Top Level Namespace
- — Documentation by YARD 0.8.1
+ — Documentation by YARD 0.8.2.1
</title>
</div>
<div id="footer">
- Generated on Fri Oct 5 22:31:14 2012 by
+ Generated on Sat Oct 6 02:05:51 2012 by
<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>
end
# Returns a list of the available sources to enable or disable
+ # @return [String] the list of available sources. Enabled sources have
+ # a star appended.
def self.sources
source_manager = SourceManager.new
source_manager.available_sources(true).join(", ")
end
+ # Enables a source via the Source Manager
def self.enable(source_name)
source_manager = SourceManager.new
source_manager.enable(source_name)
end
+ # Disables a source via the Source Manager
def self.disable(source_name)
source_manager = SourceManager.new
source_manager.disable(source_name)
end
+ # Resets all configuration for a source via the Source Manager
def self.reset(source_name)
source_manager = SourceManager.new
source_manager.reset(source_name)
module Lyricli
+
+ # This class handles the configuration of Lyricli
class Configuration
+ # Defines the paths to the default and user configuration files
def initialize
@config_path = "~/.lyricli.conf"
@defaults_path = "defaults.json"
@@instance = Configuration.new
+ # Ensure this is only called once. Only use the instance class variable
+ # to access this method, as its constructor is private.
def self.instance
@@instance
end
+ # Access configuration properties, loads config if needed beforehand.
+ #
+ # @param [String] key the configuration key to access
+ # @return [String, Hash, Array] the value of the configuration key.
def [](key)
load_config unless @config
@config[key]
end
+ # Assigns a new value to a configuration key, loads config if needed and
+ # saves it after updating.
+ #
+ # @param [String] key the configuration key to set
+ # @param [Object] value the value for the configuration key, can be any
+ # object as long as it can be converted to JSON
def []=(key, value)
load_config unless @config
@config[key] = value
save_config
end
+ # Deletes a key from the configuration, loads config if needed and saves
+ # it after deleting.
+ #
+ # @param [String] key the key to delete
def delete(key)
load_config unless @config
@config.delete(key)
private_class_method :new
- # TODO: Apart from this, load a default yml that will be used for this.
- # And just extend everything from the user's config.
+ # Loads the configuration from the user file, attempts to create it from
+ # defaults if it's not present. sets the `@config` instance variable.
def load_config
path = File.expand_path(@config_path)
end
end
+ # Serializes the `@config` Hash to JSON and saves it to a file.
def save_config
path = File.expand_path(@config_path)
file = File.new(path, "w")
private
+ # Loads the default configuration from a JSON file
def load_default_config
# Load the default
path_root = File.expand_path(File.dirname(__FILE__))
module Lyricli
+
+ # This class has the basic logic for extracting the lyrics and controlling the
+ # application
class Lyricli
+ # Constructor, initializes `@source_manager`
def initialize
@source_manager = SourceManager.new
end
+ # Raises an InvalidLyricsException which means we did not get any valid
+ # artist/song from any of the sources
+ #
+ # @raise [Lyricli::InvalidLyricsException] because we found nothing
def exit_with_error
- raise InvalidLyrics
+ raise InvalidLyricsException
end
+ # Extracts the current track, validates it and requests the lyrics from our
+ # LyricsEngine
+ #
+ # @return [String] the found lyrics, or a string indicating none were found
def get_lyrics
set_current_track
check_params
end
end
+ # Set the `@current_track` instance variable by asking the SourceManager for
+ # its current track
def set_current_track
@current_track = @source_manager.current_track
end
+ # Exits with error when there is an empty field from the current track.
def check_params
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?
module Lyricli
+ # This module contains several utility functions.
module Util
+
+ # Transforms a string from snake_case to UpperCamelCase
+ #
+ # @param [String] str the string that will be Camelized
+ # @return [String] the Camelized string.
def camelize(str)
str.split('_').map {|w| w.capitalize}.join
end
+ # Takes a class name in snake_case and attempts to find the corresponding
+ # class from the sources.
+ #
+ # @param [String] class_name the snake_case name of the class to search for.
+ # @return [Class,nil] the found class or nil
def parse_class(class_name)
begin
path = "Sources::#{class_name}"
end
end
+ # Simply escapes a param and substitutes spaces and escaped plus signs for
+ # plus signs.
+ #
+ # @param [String] p the parameter to be sanitized
+ # @return [String] the sanitized parameter
def sanitize_param(p)
URI.encode_www_form_component(p.gsub(/ /, "+")).gsub("%2B", "+")
end