]> git.r.bdr.sh - rbdr/lyricli.rb/blobdiff - doc/Lyricli/Configuration.html
Merge pull request #3 from orlando/master
[rbdr/lyricli.rb] / doc / Lyricli / Configuration.html
index 77112a3280b9e5a1cf64137ff093aec492949dcd..54b439ca2101b945c178642896a2613b50169437 100644 (file)
 </dl>
 <div class="clear"></div>
 
+<h2>Overview</h2><div class="docstring">
+  <div class="discussion">
+    <p>
+This class handles the configuration of Lyricli
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
 
+</div>
   <h2>Constant Summary</h2>
   
     <dl class="constants">
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Ensure this is only called once.
+</p>
+</div></span>
   
 </li>
 
         <li class="public ">
   <span class="summary_signature">
     
-      <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object) <strong>[]</strong>(key) </a>
+      <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (String, ...) <strong>[]</strong>(key) </a>
     
 
     
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Access configuration properties, loads config if needed beforehand.
+</p>
+</div></span>
   
 </li>
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Assigns a new value to a configuration key, loads config if needed and
+saves it after updating.
+</p>
+</div></span>
   
 </li>
 
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Deletes a key from the configuration, loads config if needed and saves it
+after deleting.
+</p>
+</div></span>
   
 </li>
 
 
   
     <span class="summary_desc"><div class='inline'><p>
-A new instance of Configuration.
+Defines the paths to the default and user configuration files.
 </p>
 </div></span>
   
@@ -268,7 +294,8 @@ A new instance of Configuration.
 
   
     <span class="summary_desc"><div class='inline'><p>
-TODO: Apart from this, load a default yml that will be used for this.
+Loads the configuration from the user file, attempts to create it from
+defaults if it&#8217;s not present.
 </p>
 </div></span>
   
@@ -292,7 +319,10 @@ TODO: Apart from this, load a default yml that will be used for this.
   
 
   
-    <span class="summary_desc"><div class='inline'></div></span>
+    <span class="summary_desc"><div class='inline'><p>
+Serializes the `@config` Hash to JSON and saves it to a file.
+</p>
+</div></span>
   
 </li>
 
@@ -315,7 +345,7 @@ TODO: Apart from this, load a default yml that will be used for this.
 </h3><div class="docstring">
   <div class="discussion">
     <p>
-A new instance of Configuration
+Defines the paths to the default and user configuration files
 </p>
 
 
@@ -330,14 +360,14 @@ A new instance of Configuration
       <pre class="lines">
 
 
-4
-5
-6
 7
-8</pre>
+8
+9
+10
+11</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 4</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 7</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'>&quot;</span><span class='tstring_content'>~/.lyricli.conf</span><span class='tstring_end'>&quot;</span></span>
@@ -365,18 +395,31 @@ A new instance of Configuration
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Ensure this is only called once. Only use the instance class variable to
+access this method, as its constructor is private.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-12
-13
-14</pre>
+17
+18
+19</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 12</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 17</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>
@@ -395,25 +438,77 @@ A new instance of Configuration
       <div class="method_details first">
   <h3 class="signature first" id="[]-instance_method">
   
-    - (<tt>Object</tt>) <strong>[]</strong>(key) 
+    - (<tt>String</tt>, ...) <strong>[]</strong>(key) 
+  
+
   
 
   
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Access configuration properties, loads config if needed beforehand.
+</p>
+
 
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
   
-</h3><table class="source_code">
+    <li>
+      
+        <span class='name'>key</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the configuration key to access
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+<p class="tag_title">Returns:</p>
+<ul class="return">
+  
+    <li>
+      
+      
+        <span class='type'>(<tt>String</tt>, <tt>Hash</tt>, <tt>Array</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the value of the configuration key.
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-16
-17
-18
-19</pre>
+25
+26
+27
+28</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 16</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 25</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>
@@ -433,20 +528,72 @@ A new instance of Configuration
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Assigns a new value to a configuration key, loads config if needed and
+saves it after updating.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>key</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the configuration key to set
+</p>
+</div>
+      
+    </li>
+  
+    <li>
+      
+        <span class='name'>value</span>
+      
+      
+        <span class='type'>(<tt>Object</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the value for the configuration key, can be any object as long as it can be
+converted to JSON
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-21
-22
-23
-24
-25</pre>
+36
+37
+38
+39
+40</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 21</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 36</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>
@@ -467,20 +614,54 @@ A new instance of Configuration
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Deletes a key from the configuration, loads config if needed and saves it
+after deleting.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  <p class="tag_title">Parameters:</p>
+<ul class="param">
+  
+    <li>
+      
+        <span class='name'>key</span>
+      
+      
+        <span class='type'>(<tt>String</tt>)</span>
+      
+      
+      
+        &mdash;
+        <div class='inline'><p>
+the key to delete
+</p>
+</div>
+      
+    </li>
+  
+</ul>
+
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-27
-28
-29
-30
-31</pre>
+46
+47
+48
+49
+50</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 27</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 46</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>
@@ -504,8 +685,8 @@ A new instance of Configuration
 </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&#8217;s config.
+Loads the configuration from the user file, attempts to create it from
+defaults if it&#8217;s not present. sets the `@config` instance variable.
 </p>
 
 
@@ -520,19 +701,19 @@ just extend everything from the user&#8217;s config.
       <pre class="lines">
 
 
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46</pre>
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 37</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 56</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>
@@ -558,21 +739,33 @@ just extend everything from the user&#8217;s config.
   
 
   
-</h3><table class="source_code">
+</h3><div class="docstring">
+  <div class="discussion">
+    <p>
+Serializes the `@config` Hash to JSON and saves it to a file.
+</p>
+
+
+  </div>
+</div>
+<div class="tags">
+  
+
+</div><table class="source_code">
   <tr>
     <td>
       <pre class="lines">
 
 
-48
-49
-50
-51
-52
-53</pre>
+68
+69
+70
+71
+72
+73</pre>
     </td>
     <td>
-      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 48</span>
+      <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 68</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>
@@ -590,7 +783,7 @@ just extend everything from the user&#8217;s config.
 </div>
 
     <div id="footer">
-  Generated on Sat Oct  6 02:05:51 2012 by
+  Generated on Sat Oct  6 03:20:24 2012 by
   <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
   0.8.2.1 (ruby-1.9.2).
 </div>