]> git.r.bdr.sh - rbdr/lyricli.rb/blame - doc/Lyricli/Configuration.html
Adds some documentation
[rbdr/lyricli.rb] / doc / Lyricli / Configuration.html
CommitLineData
823e558b
BB
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<title>
7 Class: Lyricli::Configuration
8
34d0bf15 9 &mdash; Documentation by YARD 0.8.2.1
823e558b
BB
10
11</title>
12
13 <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
15 <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
17<script type="text/javascript" charset="utf-8">
18 hasFrames = window.top.frames.main ? true : false;
19 relpath = '../';
20 framesUrl = "../frames.html#!" + escape(window.location.href);
21</script>
22
23
24 <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
25
26 <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
27
28
29 </head>
30 <body>
31 <div id="header">
32 <div id="menu">
33
34 <a href="../_index.html">Index (C)</a> &raquo;
35 <span class='title'><span class='object_link'><a href="../Lyricli.html" title="Lyricli (module)">Lyricli</a></span></span>
36 &raquo;
37 <span class="title">Configuration</span>
38
39
40 <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
41</div>
42
43 <div id="search">
44
45 <a class="full_list_link" id="class_list_link"
46 href="../class_list.html">
47 Class List
48 </a>
49
50 <a class="full_list_link" id="method_list_link"
51 href="../method_list.html">
52 Method List
53 </a>
54
55 <a class="full_list_link" id="file_list_link"
56 href="../file_list.html">
57 File List
58 </a>
59
60</div>
61 <div class="clear"></div>
62 </div>
63
64 <iframe id="search_frame"></iframe>
65
66 <div id="content"><h1>Class: Lyricli::Configuration
67
68
69
70</h1>
71
72<dl class="box">
73
74 <dt class="r1">Inherits:</dt>
75 <dd class="r1">
76 <span class="inheritName">Object</span>
77
78 <ul class="fullTree">
79 <li>Object</li>
80
81 <li class="next">Lyricli::Configuration</li>
82
83 </ul>
84 <a href="#" class="inheritanceTree">show all</a>
85
86 </dd>
87
88
89
90
91
92
93
94
95
96 <dt class="r2 last">Defined in:</dt>
97 <dd class="r2 last">lib/lyricli/configuration.rb</dd>
98
99</dl>
100<div class="clear"></div>
101
102
103 <h2>Constant Summary</h2>
104
105 <dl class="constants">
106
107 <dt id="instance-classvariable" class="">@@instance =
108
109 </dt>
110 <dd><pre class="code"><span class='const'>Configuration</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span></pre></dd>
111
112 </dl>
113
114
115
116
117
118
119
120
121
122 <h2>
123 Class Method Summary
124 <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
125 </h2>
126
127 <ul class="summary">
128
129 <li class="public ">
130 <span class="summary_signature">
131
132 <a href="#instance-class_method" title="instance (class method)">+ (Object) <strong>instance</strong> </a>
133
134
135
136 </span>
137
138
139
140
141
142
143
144
145
146 <span class="summary_desc"><div class='inline'></div></span>
147
148</li>
149
150
151 </ul>
152
153 <h2>
154 Instance Method Summary
155 <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
156 </h2>
157
158 <ul class="summary">
159
160 <li class="public ">
161 <span class="summary_signature">
162
163 <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object) <strong>[]</strong>(key) </a>
164
165
166
167 </span>
168
169
170
171
172
173
174
175
176
177 <span class="summary_desc"><div class='inline'></div></span>
178
179</li>
180
181
182 <li class="public ">
183 <span class="summary_signature">
184
185 <a href="#%5B%5D%3D-instance_method" title="#[]= (instance method)">- (Object) <strong>[]=</strong>(key, value) </a>
186
187
188
189 </span>
190
191
192
193
194
195
196
197
198
34d0bf15
BB
199 <span class="summary_desc"><div class='inline'></div></span>
200
201</li>
202
203
204 <li class="public ">
205 <span class="summary_signature">
206
207 <a href="#delete-instance_method" title="#delete (instance method)">- (Object) <strong>delete</strong>(key) </a>
208
209
210
211 </span>
212
213
214
215
216
217
218
219
220
823e558b
BB
221 <span class="summary_desc"><div class='inline'></div></span>
222
223</li>
224
225
226 <li class="public ">
227 <span class="summary_signature">
228
229 <a href="#initialize-instance_method" title="#initialize (instance method)">- (Configuration) <strong>initialize</strong> </a>
230
231
232
233 </span>
234
235
236 <span class="note title constructor">constructor</span>
237
238
239
240
241
242
243
244
245 <span class="summary_desc"><div class='inline'><p>
246A new instance of Configuration.
247</p>
248</div></span>
249
34d0bf15
BB
250</li>
251
252
253 <li class="public ">
254 <span class="summary_signature">
255
256 <a href="#load_config-instance_method" title="#load_config (instance method)">- (Object) <strong>load_config</strong> </a>
257
258
259
260 </span>
261
262
263
264
265
266
267
268
269
270 <span class="summary_desc"><div class='inline'><p>
271TODO: Apart from this, load a default yml that will be used for this.
272</p>
273</div></span>
274
275</li>
276
277
278 <li class="public ">
279 <span class="summary_signature">
280
281 <a href="#save_config-instance_method" title="#save_config (instance method)">- (Object) <strong>save_config</strong> </a>
282
283
284
285 </span>
286
287
288
289
290
291
292
293
294
295 <span class="summary_desc"><div class='inline'></div></span>
296
823e558b
BB
297</li>
298
299
300 </ul>
301
302
303<div id="constructor_details" class="method_details_list">
304 <h2>Constructor Details</h2>
305
306 <div class="method_details first">
307 <h3 class="signature first" id="initialize-instance_method">
308
309 - (<tt><span class='object_link'><a href="" title="Lyricli::Configuration (class)">Configuration</a></span></tt>) <strong>initialize</strong>
310
311
312
313
314
315</h3><div class="docstring">
316 <div class="discussion">
317 <p>
318A new instance of Configuration
319</p>
320
321
322 </div>
323</div>
324<div class="tags">
325
326
327</div><table class="source_code">
328 <tr>
329 <td>
330 <pre class="lines">
331
332
3334
3345
3356
34d0bf15
BB
3367
3378</pre>
823e558b
BB
338 </td>
339 <td>
340 <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 4</span>
341
342<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
343 <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>
344 <span class='ivar'>@defaults_path</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>defaults.json</span><span class='tstring_end'>&quot;</span></span>
34d0bf15 345 <span class='ivar'>@config</span> <span class='op'>=</span> <span class='kw'>nil</span>
823e558b
BB
346<span class='kw'>end</span></pre>
347 </td>
348 </tr>
349</table>
350</div>
351
352</div>
353
354
355 <div id="class_method_details" class="method_details_list">
356 <h2>Class Method Details</h2>
357
358
359 <div class="method_details first">
360 <h3 class="signature first" id="instance-class_method">
361
362 + (<tt>Object</tt>) <strong>instance</strong>
363
364
365
366
367
368</h3><table class="source_code">
369 <tr>
370 <td>
371 <pre class="lines">
372
373
823e558b 37412
34d0bf15
BB
37513
37614</pre>
823e558b
BB
377 </td>
378 <td>
34d0bf15 379 <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 12</span>
823e558b
BB
380
381<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
382 <span class='cvar'>@@instance</span>
383<span class='kw'>end</span></pre>
384 </td>
385 </tr>
386</table>
387</div>
388
389 </div>
390
391 <div id="instance_method_details" class="method_details_list">
392 <h2>Instance Method Details</h2>
393
394
395 <div class="method_details first">
396 <h3 class="signature first" id="[]-instance_method">
397
398 - (<tt>Object</tt>) <strong>[]</strong>(key)
399
400
401
402
403
404</h3><table class="source_code">
405 <tr>
406 <td>
407 <pre class="lines">
408
409
823e558b
BB
41016
41117
34d0bf15
BB
41218
41319</pre>
823e558b
BB
414 </td>
415 <td>
34d0bf15 416 <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 16</span>
823e558b
BB
417
418<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>
419 <span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
420 <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
421<span class='kw'>end</span></pre>
422 </td>
423 </tr>
424</table>
425</div>
426
427 <div class="method_details ">
428 <h3 class="signature " id="[]=-instance_method">
429
430 - (<tt>Object</tt>) <strong>[]=</strong>(key, value)
431
432
433
434
435
436</h3><table class="source_code">
437 <tr>
438 <td>
439 <pre class="lines">
440
441
823e558b
BB
44221
44322
44423
34d0bf15
BB
44524
44625</pre>
823e558b
BB
447 </td>
448 <td>
34d0bf15 449 <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 21</span>
823e558b
BB
450
451<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>
452 <span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
453 <span class='ivar'>@config</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
454 <span class='id identifier rubyid_save_config'>save_config</span>
455<span class='kw'>end</span></pre>
456 </td>
457 </tr>
458</table>
34d0bf15
BB
459</div>
460
461 <div class="method_details ">
462 <h3 class="signature " id="delete-instance_method">
463
464 - (<tt>Object</tt>) <strong>delete</strong>(key)
465
466
467
468
469
470</h3><table class="source_code">
471 <tr>
472 <td>
473 <pre class="lines">
474
475
47627
47728
47829
47930
48031</pre>
481 </td>
482 <td>
483 <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 27</span>
484
485<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>
486 <span class='id identifier rubyid_load_config'>load_config</span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
487 <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>
488 <span class='id identifier rubyid_save_config'>save_config</span>
489<span class='kw'>end</span></pre>
490 </td>
491 </tr>
492</table>
493</div>
494
495 <div class="method_details ">
496 <h3 class="signature " id="load_config-instance_method">
497
498 - (<tt>Object</tt>) <strong>load_config</strong>
499
500
501
502
503
504</h3><div class="docstring">
505 <div class="discussion">
506 <p>
507TODO: Apart from this, load a default yml that will be used for this. And
508just extend everything from the user&#8217;s config.
509</p>
510
511
512 </div>
513</div>
514<div class="tags">
515
516
517</div><table class="source_code">
518 <tr>
519 <td>
520 <pre class="lines">
521
522
52337
52438
52539
52640
52741
52842
52943
53044
53145
53246</pre>
533 </td>
534 <td>
535 <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 37</span>
536
537<span class='kw'>def</span> <span class='id identifier rubyid_load_config'>load_config</span>
538 <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>
539
540 <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>
541 <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'>&quot;</span><span class='tstring_content'>r</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
542 <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>
543 <span class='kw'>else</span>
544 <span class='id identifier rubyid_load_default_config'>load_default_config</span>
545 <span class='kw'>end</span>
546<span class='kw'>end</span></pre>
547 </td>
548 </tr>
549</table>
550</div>
551
552 <div class="method_details ">
553 <h3 class="signature " id="save_config-instance_method">
554
555 - (<tt>Object</tt>) <strong>save_config</strong>
556
557
558
559
560
561</h3><table class="source_code">
562 <tr>
563 <td>
564 <pre class="lines">
565
566
56748
56849
56950
57051
57152
57253</pre>
573 </td>
574 <td>
575 <pre class="code"><span class="info file"># File 'lib/lyricli/configuration.rb', line 48</span>
576
577<span class='kw'>def</span> <span class='id identifier rubyid_save_config'>save_config</span>
578 <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>
579 <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'>&quot;</span><span class='tstring_content'>w</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
580 <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>
581 <span class='id identifier rubyid_file'>file</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
582<span class='kw'>end</span></pre>
583 </td>
584 </tr>
585</table>
823e558b
BB
586</div>
587
588 </div>
589
590</div>
591
592 <div id="footer">
34d0bf15 593 Generated on Sat Oct 6 02:05:51 2012 by
823e558b 594 <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
34d0bf15 595 0.8.2.1 (ruby-1.9.2).
823e558b
BB
596</div>
597
598 </body>
599</html>