cliutils 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.yardoc/checksums +11 -11
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile.lock +12 -33
- data/README.md +1 -1
- data/Rakefile +36 -31
- data/cliutils.gemspec +3 -2
- data/lib/cliutils/configuration.rb +13 -31
- data/lib/cliutils/configurator.rb +23 -62
- data/lib/cliutils/ext/Hash+Extensions.rb +39 -78
- data/lib/cliutils/ext/Logger+Extensions.rb +6 -11
- data/lib/cliutils/ext/String+Extensions.rb +25 -13
- data/lib/cliutils/logger-delegator.rb +15 -39
- data/lib/cliutils/messenging.rb +10 -28
- data/lib/cliutils/prefs.rb +18 -43
- data/lib/cliutils/pretty-io.rb +59 -127
- data/lib/cliutils/version.rb +2 -1
- data/lib/cliutils.rb +2 -0
- metadata +20 -32
- data/bin/cliutils +0 -38
- data/doc/CLIUtils/Configuration.html +0 -373
- data/doc/CLIUtils/Configurator.html +0 -873
- data/doc/CLIUtils/LoggerDelegator.html +0 -560
- data/doc/CLIUtils/Messenging.html +0 -396
- data/doc/CLIUtils/Prefs.html +0 -609
- data/doc/CLIUtils/PrettyIO.html +0 -1333
- data/doc/CLIUtils.html +0 -131
- data/doc/Hash.html +0 -672
- data/doc/Logger.html +0 -233
- data/doc/String.html +0 -562
- data/doc/_index.html +0 -207
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -339
- data/doc/file.README.html +0 -415
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -415
- data/doc/js/app.js +0 -219
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -389
- data/doc/top-level-namespace.html +0 -114
@@ -1,873 +0,0 @@
|
|
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: CLIUtils::Configurator
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.7.4
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" 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#!CLIUtils/Configurator.html";
|
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> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../CLIUtils.html" title="CLIUtils (module)">CLIUtils</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">Configurator</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: CLIUtils::Configurator
|
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">CLIUtils::Configurator</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/cliutils/configurator.rb</dd>
|
98
|
-
|
99
|
-
</dl>
|
100
|
-
<div class="clear"></div>
|
101
|
-
|
102
|
-
<h2>Overview</h2><div class="docstring">
|
103
|
-
<div class="discussion">
|
104
|
-
|
105
|
-
<h6 id="label-"></h6>
|
106
|
-
|
107
|
-
<pre class="code ruby"><code class="ruby">Configuration Class
|
108
|
-
|
109
|
-
Manages any configuration values and the flat YAML file
|
110
|
-
into which they get stored.
|
111
|
-
======================================================</code></pre>
|
112
|
-
|
113
|
-
|
114
|
-
</div>
|
115
|
-
</div>
|
116
|
-
<div class="tags">
|
117
|
-
|
118
|
-
|
119
|
-
</div>
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
124
|
-
<ul class="summary">
|
125
|
-
|
126
|
-
<li class="public ">
|
127
|
-
<span class="summary_signature">
|
128
|
-
|
129
|
-
<a href="#config_path-instance_method" title="#config_path (instance method)">- (Object) <strong>config_path</strong> </a>
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
</span>
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
<span class="note title readonly">readonly</span>
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
<span class="summary_desc"><div class='inline'>
|
149
|
-
<h6 id="label-Attributes++%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D.">Attributes ====================================================.</h6>
|
150
|
-
</div></span>
|
151
|
-
|
152
|
-
</li>
|
153
|
-
|
154
|
-
|
155
|
-
<li class="public ">
|
156
|
-
<span class="summary_signature">
|
157
|
-
|
158
|
-
<a href="#data-instance_method" title="#data (instance method)">- (Object) <strong>data</strong> </a>
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
</span>
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
<span class="note title readonly">readonly</span>
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
<span class="summary_desc"><div class='inline'>
|
178
|
-
<h6 id="label-Attributes++%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D.">Attributes ====================================================.</h6>
|
179
|
-
</div></span>
|
180
|
-
|
181
|
-
</li>
|
182
|
-
|
183
|
-
|
184
|
-
</ul>
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
<h2>
|
191
|
-
Instance Method Summary
|
192
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
193
|
-
</h2>
|
194
|
-
|
195
|
-
<ul class="summary">
|
196
|
-
|
197
|
-
<li class="public ">
|
198
|
-
<span class="summary_signature">
|
199
|
-
|
200
|
-
<a href="#add_section-instance_method" title="#add_section (instance method)">- (Object) <strong>add_section</strong>(section_name) </a>
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
</span>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
<span class="summary_desc"><div class='inline'>
|
215
|
-
<p>—————————————————- add_section method.</p>
|
216
|
-
</div></span>
|
217
|
-
|
218
|
-
</li>
|
219
|
-
|
220
|
-
|
221
|
-
<li class="public ">
|
222
|
-
<span class="summary_signature">
|
223
|
-
|
224
|
-
<a href="#delete_section-instance_method" title="#delete_section (instance method)">- (Object) <strong>delete_section</strong>(section_name) </a>
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
</span>
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
<span class="summary_desc"><div class='inline'>
|
239
|
-
<p>—————————————————- delete_section method.</p>
|
240
|
-
</div></span>
|
241
|
-
|
242
|
-
</li>
|
243
|
-
|
244
|
-
|
245
|
-
<li class="public ">
|
246
|
-
<span class="summary_signature">
|
247
|
-
|
248
|
-
<a href="#ingest_prefs-instance_method" title="#ingest_prefs (instance method)">- (Object) <strong>ingest_prefs</strong>(prefs) </a>
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
</span>
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
<span class="summary_desc"><div class='inline'>
|
263
|
-
<p>—————————————————- ingest_prefs method.</p>
|
264
|
-
</div></span>
|
265
|
-
|
266
|
-
</li>
|
267
|
-
|
268
|
-
|
269
|
-
<li class="public ">
|
270
|
-
<span class="summary_signature">
|
271
|
-
|
272
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Configurator) <strong>initialize</strong>(path) </a>
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
</span>
|
277
|
-
|
278
|
-
|
279
|
-
<span class="note title constructor">constructor</span>
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
<span class="summary_desc"><div class='inline'>
|
289
|
-
<h6 id="label-Methods++%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D++----------------------------------------------------++initialize+method.">Methods ==================================================== —————————————————- initialize method.</h6>
|
290
|
-
</div></span>
|
291
|
-
|
292
|
-
</li>
|
293
|
-
|
294
|
-
|
295
|
-
<li class="public ">
|
296
|
-
<span class="summary_signature">
|
297
|
-
|
298
|
-
<a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(name, *args, &block) </a>
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
</span>
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
<span class="summary_desc"><div class='inline'>
|
313
|
-
<p>—————————————————- method_missing method.</p>
|
314
|
-
</div></span>
|
315
|
-
|
316
|
-
</li>
|
317
|
-
|
318
|
-
|
319
|
-
<li class="public ">
|
320
|
-
<span class="summary_signature">
|
321
|
-
|
322
|
-
<a href="#reset-instance_method" title="#reset (instance method)">- (Object) <strong>reset</strong> </a>
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
</span>
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
<span class="summary_desc"><div class='inline'>
|
337
|
-
<p>—————————————————- reset method.</p>
|
338
|
-
</div></span>
|
339
|
-
|
340
|
-
</li>
|
341
|
-
|
342
|
-
|
343
|
-
<li class="public ">
|
344
|
-
<span class="summary_signature">
|
345
|
-
|
346
|
-
<a href="#save-instance_method" title="#save (instance method)">- (Object) <strong>save</strong> </a>
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
</span>
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
<span class="summary_desc"><div class='inline'>
|
361
|
-
<p>—————————————————- save method.</p>
|
362
|
-
</div></span>
|
363
|
-
|
364
|
-
</li>
|
365
|
-
|
366
|
-
|
367
|
-
</ul>
|
368
|
-
|
369
|
-
|
370
|
-
<div id="constructor_details" class="method_details_list">
|
371
|
-
<h2>Constructor Details</h2>
|
372
|
-
|
373
|
-
<div class="method_details first">
|
374
|
-
<h3 class="signature first" id="initialize-instance_method">
|
375
|
-
|
376
|
-
- (<tt><span class='object_link'><a href="" title="CLIUtils::Configurator (class)">Configurator</a></span></tt>) <strong>initialize</strong>(path)
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
</h3><div class="docstring">
|
383
|
-
<div class="discussion">
|
384
|
-
|
385
|
-
<h6 id="label-"></h6>
|
386
|
-
|
387
|
-
<pre class="code ruby"><code class="ruby">Methods
|
388
|
-
====================================================
|
389
|
-
----------------------------------------------------
|
390
|
-
initialize method
|
391
|
-
|
392
|
-
Initializes configuration from a flat file.
|
393
|
-
@param path The filepath to the config YAML
|
394
|
-
@return void
|
395
|
-
----------------------------------------------------</code></pre>
|
396
|
-
|
397
|
-
|
398
|
-
</div>
|
399
|
-
</div>
|
400
|
-
<div class="tags">
|
401
|
-
|
402
|
-
|
403
|
-
</div><table class="source_code">
|
404
|
-
<tr>
|
405
|
-
<td>
|
406
|
-
<pre class="lines">
|
407
|
-
|
408
|
-
|
409
|
-
26
|
410
|
-
27
|
411
|
-
28
|
412
|
-
29
|
413
|
-
30
|
414
|
-
31
|
415
|
-
32
|
416
|
-
33
|
417
|
-
34
|
418
|
-
35</pre>
|
419
|
-
</td>
|
420
|
-
<td>
|
421
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 26</span>
|
422
|
-
|
423
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
424
|
-
<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='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
425
|
-
<span class='ivar'>@config_path</span> <span class='op'>=</span> <span class='id identifier rubyid__path'>_path</span>
|
426
|
-
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
427
|
-
|
428
|
-
<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>
|
429
|
-
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='const'>YAML</span><span class='op'>::</span><span class='id identifier rubyid_load_file'>load_file</span><span class='lparen'>(</span><span class='id identifier rubyid__path'>_path</span><span class='rparen'>)</span>
|
430
|
-
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_deep_merge!'>deep_merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_deep_symbolize_keys!'>deep_symbolize_keys!</span>
|
431
|
-
<span class='kw'>end</span>
|
432
|
-
<span class='kw'>end</span></pre>
|
433
|
-
</td>
|
434
|
-
</tr>
|
435
|
-
</table>
|
436
|
-
</div>
|
437
|
-
|
438
|
-
</div>
|
439
|
-
<div id="method_missing_details" class="method_details_list">
|
440
|
-
<h2>Dynamic Method Handling</h2>
|
441
|
-
<p class="notice this">
|
442
|
-
This class handles dynamic methods through the <tt>method_missing</tt> method
|
443
|
-
|
444
|
-
</p>
|
445
|
-
|
446
|
-
<div class="method_details first">
|
447
|
-
<h3 class="signature first" id="method_missing-instance_method">
|
448
|
-
|
449
|
-
- (<tt>Object</tt>) <strong>method_missing</strong>(name, *args, &block)
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
</h3><div class="docstring">
|
456
|
-
<div class="discussion">
|
457
|
-
<hr>
|
458
|
-
|
459
|
-
<pre class="code ruby"><code class="ruby">method_missing method
|
460
|
-
|
461
|
-
Allows this module to return data from the config
|
462
|
-
Hash when given a method name that matches a key.
|
463
|
-
@param name
|
464
|
-
@param *args
|
465
|
-
@param &block
|
466
|
-
@return Hash
|
467
|
-
----------------------------------------------------
|
468
|
-
</code></pre>
|
469
|
-
|
470
|
-
|
471
|
-
</div>
|
472
|
-
</div>
|
473
|
-
<div class="tags">
|
474
|
-
|
475
|
-
|
476
|
-
</div><table class="source_code">
|
477
|
-
<tr>
|
478
|
-
<td>
|
479
|
-
<pre class="lines">
|
480
|
-
|
481
|
-
|
482
|
-
94
|
483
|
-
95
|
484
|
-
96</pre>
|
485
|
-
</td>
|
486
|
-
<td>
|
487
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 94</span>
|
488
|
-
|
489
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
490
|
-
<span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
491
|
-
<span class='kw'>end</span></pre>
|
492
|
-
</td>
|
493
|
-
</tr>
|
494
|
-
</table>
|
495
|
-
</div>
|
496
|
-
|
497
|
-
</div>
|
498
|
-
|
499
|
-
<div id="instance_attr_details" class="attr_details">
|
500
|
-
<h2>Instance Attribute Details</h2>
|
501
|
-
|
502
|
-
|
503
|
-
<span id=""></span>
|
504
|
-
<div class="method_details first">
|
505
|
-
<h3 class="signature first" id="config_path-instance_method">
|
506
|
-
|
507
|
-
- (<tt>Object</tt>) <strong>config_path</strong> <span class="extras">(readonly)</span>
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
</h3><div class="docstring">
|
514
|
-
<div class="discussion">
|
515
|
-
|
516
|
-
<h6 id="label-"></h6>
|
517
|
-
|
518
|
-
<pre class="code ruby"><code class="ruby">Attributes
|
519
|
-
====================================================</code></pre>
|
520
|
-
|
521
|
-
|
522
|
-
</div>
|
523
|
-
</div>
|
524
|
-
<div class="tags">
|
525
|
-
|
526
|
-
|
527
|
-
</div><table class="source_code">
|
528
|
-
<tr>
|
529
|
-
<td>
|
530
|
-
<pre class="lines">
|
531
|
-
|
532
|
-
|
533
|
-
14
|
534
|
-
15
|
535
|
-
16</pre>
|
536
|
-
</td>
|
537
|
-
<td>
|
538
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 14</span>
|
539
|
-
|
540
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_config_path'>config_path</span>
|
541
|
-
<span class='ivar'>@config_path</span>
|
542
|
-
<span class='kw'>end</span></pre>
|
543
|
-
</td>
|
544
|
-
</tr>
|
545
|
-
</table>
|
546
|
-
</div>
|
547
|
-
|
548
|
-
|
549
|
-
<span id=""></span>
|
550
|
-
<div class="method_details ">
|
551
|
-
<h3 class="signature " id="data-instance_method">
|
552
|
-
|
553
|
-
- (<tt>Object</tt>) <strong>data</strong> <span class="extras">(readonly)</span>
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
</h3><div class="docstring">
|
560
|
-
<div class="discussion">
|
561
|
-
|
562
|
-
<h6 id="label-"></h6>
|
563
|
-
|
564
|
-
<pre class="code ruby"><code class="ruby">Attributes
|
565
|
-
====================================================</code></pre>
|
566
|
-
|
567
|
-
|
568
|
-
</div>
|
569
|
-
</div>
|
570
|
-
<div class="tags">
|
571
|
-
|
572
|
-
|
573
|
-
</div><table class="source_code">
|
574
|
-
<tr>
|
575
|
-
<td>
|
576
|
-
<pre class="lines">
|
577
|
-
|
578
|
-
|
579
|
-
14
|
580
|
-
15
|
581
|
-
16</pre>
|
582
|
-
</td>
|
583
|
-
<td>
|
584
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 14</span>
|
585
|
-
|
586
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_data'>data</span>
|
587
|
-
<span class='ivar'>@data</span>
|
588
|
-
<span class='kw'>end</span></pre>
|
589
|
-
</td>
|
590
|
-
</tr>
|
591
|
-
</table>
|
592
|
-
</div>
|
593
|
-
|
594
|
-
</div>
|
595
|
-
|
596
|
-
|
597
|
-
<div id="instance_method_details" class="method_details_list">
|
598
|
-
<h2>Instance Method Details</h2>
|
599
|
-
|
600
|
-
|
601
|
-
<div class="method_details first">
|
602
|
-
<h3 class="signature first" id="add_section-instance_method">
|
603
|
-
|
604
|
-
- (<tt>Object</tt>) <strong>add_section</strong>(section_name)
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
</h3><div class="docstring">
|
611
|
-
<div class="discussion">
|
612
|
-
<hr>
|
613
|
-
|
614
|
-
<pre class="code ruby"><code class="ruby">add_section method
|
615
|
-
|
616
|
-
Adds a new section to the config file (if it doesn't
|
617
|
-
already exist).
|
618
|
-
@param section_name The section to add
|
619
|
-
@return Void
|
620
|
-
----------------------------------------------------</code></pre>
|
621
|
-
|
622
|
-
|
623
|
-
</div>
|
624
|
-
</div>
|
625
|
-
<div class="tags">
|
626
|
-
|
627
|
-
|
628
|
-
</div><table class="source_code">
|
629
|
-
<tr>
|
630
|
-
<td>
|
631
|
-
<pre class="lines">
|
632
|
-
|
633
|
-
|
634
|
-
45
|
635
|
-
46
|
636
|
-
47
|
637
|
-
48
|
638
|
-
49
|
639
|
-
50
|
640
|
-
51</pre>
|
641
|
-
</td>
|
642
|
-
<td>
|
643
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 45</span>
|
644
|
-
|
645
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_add_section'>add_section</span><span class='lparen'>(</span><span class='id identifier rubyid_section_name'>section_name</span><span class='rparen'>)</span>
|
646
|
-
<span class='kw'>if</span> <span class='op'>!</span><span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_section_name'>section_name</span><span class='rparen'>)</span>
|
647
|
-
<span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_section_name'>section_name</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
648
|
-
<span class='kw'>else</span>
|
649
|
-
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Section already exists: </span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_section_name'>section_name</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
650
|
-
<span class='kw'>end</span>
|
651
|
-
<span class='kw'>end</span></pre>
|
652
|
-
</td>
|
653
|
-
</tr>
|
654
|
-
</table>
|
655
|
-
</div>
|
656
|
-
|
657
|
-
<div class="method_details ">
|
658
|
-
<h3 class="signature " id="delete_section-instance_method">
|
659
|
-
|
660
|
-
- (<tt>Object</tt>) <strong>delete_section</strong>(section_name)
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
</h3><div class="docstring">
|
667
|
-
<div class="discussion">
|
668
|
-
<hr>
|
669
|
-
|
670
|
-
<pre class="code ruby"><code class="ruby">delete_section method
|
671
|
-
|
672
|
-
Removes a section to the config file (if it exists).
|
673
|
-
@param section_name The section to remove
|
674
|
-
@return Void
|
675
|
-
----------------------------------------------------</code></pre>
|
676
|
-
|
677
|
-
|
678
|
-
</div>
|
679
|
-
</div>
|
680
|
-
<div class="tags">
|
681
|
-
|
682
|
-
|
683
|
-
</div><table class="source_code">
|
684
|
-
<tr>
|
685
|
-
<td>
|
686
|
-
<pre class="lines">
|
687
|
-
|
688
|
-
|
689
|
-
60
|
690
|
-
61
|
691
|
-
62
|
692
|
-
63
|
693
|
-
64
|
694
|
-
65
|
695
|
-
66</pre>
|
696
|
-
</td>
|
697
|
-
<td>
|
698
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 60</span>
|
699
|
-
|
700
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_delete_section'>delete_section</span><span class='lparen'>(</span><span class='id identifier rubyid_section_name'>section_name</span><span class='rparen'>)</span>
|
701
|
-
<span class='kw'>if</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_section_name'>section_name</span><span class='rparen'>)</span>
|
702
|
-
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_section_name'>section_name</span><span class='rparen'>)</span>
|
703
|
-
<span class='kw'>else</span>
|
704
|
-
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot delete nonexistent section: </span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_section_name'>section_name</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
705
|
-
<span class='kw'>end</span>
|
706
|
-
<span class='kw'>end</span></pre>
|
707
|
-
</td>
|
708
|
-
</tr>
|
709
|
-
</table>
|
710
|
-
</div>
|
711
|
-
|
712
|
-
<div class="method_details ">
|
713
|
-
<h3 class="signature " id="ingest_prefs-instance_method">
|
714
|
-
|
715
|
-
- (<tt>Object</tt>) <strong>ingest_prefs</strong>(prefs)
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
</h3><div class="docstring">
|
722
|
-
<div class="discussion">
|
723
|
-
<hr>
|
724
|
-
|
725
|
-
<pre class="code ruby"><code class="ruby">ingest_prefs method
|
726
|
-
|
727
|
-
Ingests a Prefs class and adds its answers to the
|
728
|
-
configuration data.
|
729
|
-
@param prefs The Prefs class to examine
|
730
|
-
@return Void
|
731
|
-
----------------------------------------------------
|
732
|
-
</code></pre>
|
733
|
-
|
734
|
-
|
735
|
-
</div>
|
736
|
-
</div>
|
737
|
-
<div class="tags">
|
738
|
-
|
739
|
-
|
740
|
-
</div><table class="source_code">
|
741
|
-
<tr>
|
742
|
-
<td>
|
743
|
-
<pre class="lines">
|
744
|
-
|
745
|
-
|
746
|
-
76
|
747
|
-
77
|
748
|
-
78
|
749
|
-
79
|
750
|
-
80
|
751
|
-
81
|
752
|
-
82</pre>
|
753
|
-
</td>
|
754
|
-
<td>
|
755
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 76</span>
|
756
|
-
|
757
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_ingest_prefs'>ingest_prefs</span><span class='lparen'>(</span><span class='id identifier rubyid_prefs'>prefs</span><span class='rparen'>)</span>
|
758
|
-
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Invaid Prefs class</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_prefs'>prefs</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Prefs</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_prefs'>prefs</span><span class='period'>.</span><span class='id identifier rubyid_answers'>answers</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
759
|
-
<span class='id identifier rubyid_prefs'>prefs</span><span class='period'>.</span><span class='id identifier rubyid_answers'>answers</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_p'>p</span><span class='op'>|</span>
|
760
|
-
<span class='id identifier rubyid_add_section'>add_section</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:section</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:section</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
761
|
-
<span class='ivar'>@data</span><span class='lbracket'>[</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:section</span><span class='rbracket'>]</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:key</span><span class='rbracket'>]</span> <span class='op'>=></span> <span class='id identifier rubyid_p'>p</span><span class='lbracket'>[</span><span class='symbol'>:answer</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
762
|
-
<span class='kw'>end</span>
|
763
|
-
<span class='kw'>end</span></pre>
|
764
|
-
</td>
|
765
|
-
</tr>
|
766
|
-
</table>
|
767
|
-
</div>
|
768
|
-
|
769
|
-
<div class="method_details ">
|
770
|
-
<h3 class="signature " id="reset-instance_method">
|
771
|
-
|
772
|
-
- (<tt>Object</tt>) <strong>reset</strong>
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
</h3><div class="docstring">
|
779
|
-
<div class="discussion">
|
780
|
-
<hr>
|
781
|
-
|
782
|
-
<pre class="code ruby"><code class="ruby">reset method
|
783
|
-
|
784
|
-
Clears the configuration data.
|
785
|
-
@return Void
|
786
|
-
----------------------------------------------------</code></pre>
|
787
|
-
|
788
|
-
|
789
|
-
</div>
|
790
|
-
</div>
|
791
|
-
<div class="tags">
|
792
|
-
|
793
|
-
|
794
|
-
</div><table class="source_code">
|
795
|
-
<tr>
|
796
|
-
<td>
|
797
|
-
<pre class="lines">
|
798
|
-
|
799
|
-
|
800
|
-
104
|
801
|
-
105
|
802
|
-
106</pre>
|
803
|
-
</td>
|
804
|
-
<td>
|
805
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 104</span>
|
806
|
-
|
807
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_reset'>reset</span>
|
808
|
-
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
809
|
-
<span class='kw'>end</span></pre>
|
810
|
-
</td>
|
811
|
-
</tr>
|
812
|
-
</table>
|
813
|
-
</div>
|
814
|
-
|
815
|
-
<div class="method_details ">
|
816
|
-
<h3 class="signature " id="save-instance_method">
|
817
|
-
|
818
|
-
- (<tt>Object</tt>) <strong>save</strong>
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
</h3><div class="docstring">
|
825
|
-
<div class="discussion">
|
826
|
-
<hr>
|
827
|
-
|
828
|
-
<pre class="code ruby"><code class="ruby">save method
|
829
|
-
|
830
|
-
Saves the configuration data to the previously
|
831
|
-
stored flat file.
|
832
|
-
@return Void
|
833
|
-
----------------------------------------------------</code></pre>
|
834
|
-
|
835
|
-
|
836
|
-
</div>
|
837
|
-
</div>
|
838
|
-
<div class="tags">
|
839
|
-
|
840
|
-
|
841
|
-
</div><table class="source_code">
|
842
|
-
<tr>
|
843
|
-
<td>
|
844
|
-
<pre class="lines">
|
845
|
-
|
846
|
-
|
847
|
-
115
|
848
|
-
116
|
849
|
-
117</pre>
|
850
|
-
</td>
|
851
|
-
<td>
|
852
|
-
<pre class="code"><span class="info file"># File 'lib/cliutils/configurator.rb', line 115</span>
|
853
|
-
|
854
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_save'>save</span>
|
855
|
-
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='ivar'>@config_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='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_deep_stringify_keys'>deep_stringify_keys</span><span class='period'>.</span><span class='id identifier rubyid_to_yaml'>to_yaml</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
856
|
-
<span class='kw'>end</span></pre>
|
857
|
-
</td>
|
858
|
-
</tr>
|
859
|
-
</table>
|
860
|
-
</div>
|
861
|
-
|
862
|
-
</div>
|
863
|
-
|
864
|
-
</div>
|
865
|
-
|
866
|
-
<div id="footer">
|
867
|
-
Generated on Sat Mar 29 17:22:03 2014 by
|
868
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
869
|
-
0.8.7.4 (ruby-2.1.0).
|
870
|
-
</div>
|
871
|
-
|
872
|
-
</body>
|
873
|
-
</html>
|