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">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
7 Class: Lyricli::Configuration
9 — Documentation by YARD
0.8.2.1
13 <link rel=
"stylesheet" href=
"../css/style.css" type=
"text/css" media=
"screen" charset=
"utf-8" />
15 <link rel=
"stylesheet" href=
"../css/common.css" type=
"text/css" media=
"screen" charset=
"utf-8" />
17 <script type=
"text/javascript" charset=
"utf-8">
18 hasFrames = window.top.frames.main ? true : false;
20 framesUrl = "../frames.html#!" + escape(window.location.href);
24 <script type=
"text/javascript" charset=
"utf-8" src=
"../js/jquery.js"></script>
26 <script type=
"text/javascript" charset=
"utf-8" src=
"../js/app.js"></script>
34 <a href=
"../_index.html">Index (C)
</a> »
35 <span class='title'
><span class='object_link'
><a href=
"../Lyricli.html" title=
"Lyricli (module)">Lyricli
</a></span></span>
37 <span class=
"title">Configuration
</span>
40 <div class=
"noframes"><span class=
"title">(
</span><a href=
"." target=
"_top">no frames
</a><span class=
"title">)
</span></div>
45 <a class=
"full_list_link" id=
"class_list_link"
46 href=
"../class_list.html">
50 <a class=
"full_list_link" id=
"method_list_link"
51 href=
"../method_list.html">
55 <a class=
"full_list_link" id=
"file_list_link"
56 href=
"../file_list.html">
61 <div class=
"clear"></div>
64 <iframe id=
"search_frame"></iframe>
66 <div id=
"content"><h1>Class: Lyricli::Configuration
74 <dt class=
"r1">Inherits:
</dt>
76 <span class=
"inheritName">Object
</span>
81 <li class=
"next">Lyricli::Configuration
</li>
84 <a href=
"#" class=
"inheritanceTree">show all
</a>
96 <dt class=
"r2 last">Defined in:
</dt>
97 <dd class=
"r2 last">lib/lyricli/configuration.rb
</dd>
100 <div class=
"clear"></div>
103 <h2>Constant Summary
</h2>
105 <dl class=
"constants">
107 <dt id=
"instance-classvariable" class=
"">@@instance =
110 <dd><pre class=
"code"><span class='const'
>Configuration
</span><span class='period'
>.
</span><span class='id identifier rubyid_new'
>new
</span></pre></dd>
124 <small>(
<a href=
"#" class=
"summary_toggle">collapse
</a>)
</small>
130 <span class=
"summary_signature">
132 <a href=
"#instance-class_method" title=
"instance (class method)">+ (Object)
<strong>instance
</strong> </a>
146 <span class=
"summary_desc"><div class='inline'
></div></span>
154 Instance Method Summary
155 <small>(
<a href=
"#" class=
"summary_toggle">collapse
</a>)
</small>
161 <span class=
"summary_signature">
163 <a href=
"#%5B%5D-instance_method" title=
"#[] (instance method)">- (Object)
<strong>[]
</strong>(key)
</a>
177 <span class=
"summary_desc"><div class='inline'
></div></span>
183 <span class=
"summary_signature">
185 <a href=
"#%5B%5D%3D-instance_method" title=
"#[]= (instance method)">- (Object)
<strong>[]=
</strong>(key, value)
</a>
199 <span class=
"summary_desc"><div class='inline'
></div></span>
205 <span class=
"summary_signature">
207 <a href=
"#delete-instance_method" title=
"#delete (instance method)">- (Object)
<strong>delete
</strong>(key)
</a>
221 <span class=
"summary_desc"><div class='inline'
></div></span>
227 <span class=
"summary_signature">
229 <a href=
"#initialize-instance_method" title=
"#initialize (instance method)">- (Configuration)
<strong>initialize
</strong> </a>
236 <span class=
"note title constructor">constructor
</span>
245 <span class=
"summary_desc"><div class='inline'
><p>
246 A new instance of Configuration.
254 <span class=
"summary_signature">
256 <a href=
"#load_config-instance_method" title=
"#load_config (instance method)">- (Object)
<strong>load_config
</strong> </a>
270 <span class=
"summary_desc"><div class='inline'
><p>
271 TODO: Apart from this, load a default yml that will be used for this.
279 <span class=
"summary_signature">
281 <a href=
"#save_config-instance_method" title=
"#save_config (instance method)">- (Object)
<strong>save_config
</strong> </a>
295 <span class=
"summary_desc"><div class='inline'
></div></span>
303 <div id=
"constructor_details" class=
"method_details_list">
304 <h2>Constructor Details
</h2>
306 <div class=
"method_details first">
307 <h3 class=
"signature first" id=
"initialize-instance_method">
309 - (
<tt><span class='object_link'
><a href=
"" title=
"Lyricli::Configuration (class)">Configuration
</a></span></tt>)
<strong>initialize
</strong>
315 </h3><div class=
"docstring">
316 <div class=
"discussion">
318 A new instance of Configuration
327 </div><table class=
"source_code">
340 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/configuration.rb', line
4</span>
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'
>"</span><span class='tstring_content'
>~/.lyricli.conf
</span><span class='tstring_end'
>"</span></span>
344 <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>
345 <span class='ivar'
>@config
</span> <span class='op'
>=
</span> <span class='kw'
>nil
</span>
346 <span class='kw'
>end
</span></pre>
355 <div id=
"class_method_details" class=
"method_details_list">
356 <h2>Class Method Details
</h2>
359 <div class=
"method_details first">
360 <h3 class=
"signature first" id=
"instance-class_method">
362 + (
<tt>Object
</tt>)
<strong>instance
</strong>
368 </h3><table class=
"source_code">
379 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/configuration.rb', line
12</span>
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>
391 <div id=
"instance_method_details" class=
"method_details_list">
392 <h2>Instance Method Details
</h2>
395 <div class=
"method_details first">
396 <h3 class=
"signature first" id=
"[]-instance_method">
398 - (
<tt>Object
</tt>)
<strong>[]
</strong>(key)
404 </h3><table class=
"source_code">
416 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/configuration.rb', line
16</span>
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>
427 <div class=
"method_details ">
428 <h3 class=
"signature " id=
"[]=-instance_method">
430 - (
<tt>Object
</tt>)
<strong>[]=
</strong>(key, value)
436 </h3><table class=
"source_code">
449 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/configuration.rb', line
21</span>
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>
461 <div class=
"method_details ">
462 <h3 class=
"signature " id=
"delete-instance_method">
464 - (
<tt>Object
</tt>)
<strong>delete
</strong>(key)
470 </h3><table class=
"source_code">
483 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/configuration.rb', line
27</span>
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>
495 <div class=
"method_details ">
496 <h3 class=
"signature " id=
"load_config-instance_method">
498 - (
<tt>Object
</tt>)
<strong>load_config
</strong>
504 </h3><div class=
"docstring">
505 <div class=
"discussion">
507 TODO: Apart from this, load a default yml that will be used for this. And
508 just extend everything from the user
’s config.
517 </div><table class=
"source_code">
535 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/configuration.rb', line
37</span>
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>
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'
>"</span><span class='tstring_content'
>r
</span><span class='tstring_end'
>"</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>
552 <div class=
"method_details ">
553 <h3 class=
"signature " id=
"save_config-instance_method">
555 - (
<tt>Object
</tt>)
<strong>save_config
</strong>
561 </h3><table class=
"source_code">
575 <pre class=
"code"><span class=
"info file"># File 'lib/lyricli/configuration.rb', line
48</span>
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'
>"</span><span class='tstring_content'
>w
</span><span class='tstring_end'
>"</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>
593 Generated on Sat Oct
6 02:
05:
51 2012 by
594 <a href=
"http://yardoc.org" title=
"Yay! A Ruby Documentation Tool" target=
"_parent">yard
</a>
595 0.8.2.1 (ruby-
1.9.2).