cliutils 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +48 -0
- data/LICENSE.txt +22 -0
- data/README.md +288 -0
- data/README.rdoc +19 -0
- data/Rakefile +45 -0
- data/bin/cliutils +38 -0
- data/cliutils.gemspec +28 -0
- data/features/cli_manager.feature +13 -0
- data/features/step_definitions/cli_manager_steps.rb +1 -0
- data/features/support/env.rb +16 -0
- data/html/CLIUtils/Configuration.html +271 -0
- data/html/CLIUtils/Configurator.html +504 -0
- data/html/CLIUtils/LoggerDelegator.html +344 -0
- data/html/CLIUtils/Messenging.html +284 -0
- data/html/CLIUtils/Prefs.html +330 -0
- data/html/CLIUtils/PrettyIO.html +799 -0
- data/html/CLIUtils.html +112 -0
- data/html/Hash.html +453 -0
- data/html/Logger.html +183 -0
- data/html/Object.html +120 -0
- data/html/README_md.html +454 -0
- data/html/String.html +413 -0
- data/html/created.rid +13 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/fonts.css +167 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +455 -0
- data/html/js/darkfish.js +140 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +580 -0
- data/html/table_of_contents.html +399 -0
- data/lib/.DS_Store +0 -0
- data/lib/cliutils/configuration.rb +48 -0
- data/lib/cliutils/configurator.rb +119 -0
- data/lib/cliutils/ext/Hash+Extensions.rb +145 -0
- data/lib/cliutils/ext/Logger+Extensions.rb +27 -0
- data/lib/cliutils/ext/String+Extensions.rb +26 -0
- data/lib/cliutils/logger-delegator.rb +66 -0
- data/lib/cliutils/messenging.rb +51 -0
- data/lib/cliutils/prefs.rb +116 -0
- data/lib/cliutils/pretty-io.rb +255 -0
- data/lib/cliutils/version.rb +3 -0
- data/lib/cliutils.rb +15 -0
- data/res/readme-images/messenger-types-1.png +0 -0
- data/res/readme-images/messenger-warn.png +0 -0
- data/res/readme-images/multi-logger.png +0 -0
- data/res/readme-images/prettyio-color-chart.png +0 -0
- data/res/readme-images/prettyio-gnarly-text.png +0 -0
- data/res/readme-images/prettyio-red-text.png +0 -0
- data/res/readme-images/prompting.png +0 -0
- data/res/readme-images/wrapping.png +0 -0
- data/test/configurator_test.rb +50 -0
- data/test/hash_extensions_test.rb +50 -0
- data/test/logger_extensions_test.rb +16 -0
- data/test/messenging_test.rb +53 -0
- data/test/prefs_test.rb +29 -0
- data/test/string_extesions_test.rb +14 -0
- data/test/test_files/prefstest.yaml +33 -0
- metadata +199 -0
@@ -0,0 +1,504 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class CLIUtils::Configurator - CLIUtils</title>
|
8
|
+
|
9
|
+
<link href="../fonts.css" rel="stylesheet">
|
10
|
+
<link href="../rdoc.css" rel="stylesheet">
|
11
|
+
|
12
|
+
<script type="text/javascript">
|
13
|
+
var rdoc_rel_prefix = "../";
|
14
|
+
</script>
|
15
|
+
|
16
|
+
<script src="../js/jquery.js"></script>
|
17
|
+
<script src="../js/navigation.js"></script>
|
18
|
+
<script src="../js/search_index.js"></script>
|
19
|
+
<script src="../js/search.js"></script>
|
20
|
+
<script src="../js/searcher.js"></script>
|
21
|
+
<script src="../js/darkfish.js"></script>
|
22
|
+
|
23
|
+
|
24
|
+
<body id="top" role="document" class="class">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="../index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
34
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
35
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
40
|
+
<form action="#" method="get" accept-charset="utf-8">
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
45
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
<div class="nav-section">
|
58
|
+
<h3>Table of Contents</h3>
|
59
|
+
|
60
|
+
<ul class="link-list" role="directory">
|
61
|
+
<li><a href="#class-CLIUtils::Configurator-label-"></a>
|
62
|
+
<li><a href="#class-CLIUtils::Configurator-label-"></a>
|
63
|
+
</ul>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
<div id="class-metadata">
|
68
|
+
|
69
|
+
<div id="parent-class-section" class="nav-section">
|
70
|
+
<h3>Parent</h3>
|
71
|
+
|
72
|
+
|
73
|
+
<p class="link">Object
|
74
|
+
|
75
|
+
</div>
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<!-- Method Quickref -->
|
80
|
+
<div id="method-list-section" class="nav-section">
|
81
|
+
<h3>Methods</h3>
|
82
|
+
|
83
|
+
<ul class="link-list" role="directory">
|
84
|
+
|
85
|
+
<li ><a href="#method-c-new">::new</a>
|
86
|
+
|
87
|
+
<li ><a href="#method-i-add_section">#add_section</a>
|
88
|
+
|
89
|
+
<li ><a href="#method-i-delete_section">#delete_section</a>
|
90
|
+
|
91
|
+
<li ><a href="#method-i-ingest_prefs">#ingest_prefs</a>
|
92
|
+
|
93
|
+
<li ><a href="#method-i-method_missing">#method_missing</a>
|
94
|
+
|
95
|
+
<li ><a href="#method-i-reset">#reset</a>
|
96
|
+
|
97
|
+
<li ><a href="#method-i-save">#save</a>
|
98
|
+
|
99
|
+
</ul>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
</nav>
|
104
|
+
|
105
|
+
<main role="main" aria-labelledby="class-CLIUtils::Configurator">
|
106
|
+
<h1 id="class-CLIUtils::Configurator" class="class">
|
107
|
+
class CLIUtils::Configurator
|
108
|
+
</h1>
|
109
|
+
|
110
|
+
<section class="description">
|
111
|
+
|
112
|
+
<h6 id="class-CLIUtils::Configurator-label-"><span><a href="#class-CLIUtils::Configurator-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
113
|
+
|
114
|
+
<p><a href="Configuration.html">Configuration</a> Class</p>
|
115
|
+
|
116
|
+
<p>Manages any configuration values and the flat YAML file into which they get
|
117
|
+
stored.</p>
|
118
|
+
|
119
|
+
<h6 id="class-CLIUtils::Configurator-label-"><span><a href="#class-CLIUtils::Configurator-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
120
|
+
|
121
|
+
</section>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
<section class="attribute-method-details" class="method-section">
|
135
|
+
<header>
|
136
|
+
<h3>Attributes</h3>
|
137
|
+
</header>
|
138
|
+
|
139
|
+
|
140
|
+
<div id="attribute-i-config_path" class="method-detail">
|
141
|
+
<div class="method-heading attribute-method-heading">
|
142
|
+
<span class="method-name">config_path</span><span
|
143
|
+
class="attribute-access-type">[R]</span>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
<div class="method-description">
|
147
|
+
|
148
|
+
<h6 id="attribute-i-config_path-label-"><span><a href="#attribute-i-config_path-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
149
|
+
|
150
|
+
<p>Attributes</p>
|
151
|
+
|
152
|
+
<h6 id="attribute-i-config_path-label-"><span><a href="#attribute-i-config_path-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
153
|
+
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div id="attribute-i-data" class="method-detail">
|
158
|
+
<div class="method-heading attribute-method-heading">
|
159
|
+
<span class="method-name">data</span><span
|
160
|
+
class="attribute-access-type">[R]</span>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
<div class="method-description">
|
164
|
+
|
165
|
+
<h6 id="attribute-i-data-label-"><span><a href="#attribute-i-data-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
166
|
+
|
167
|
+
<p>Attributes</p>
|
168
|
+
|
169
|
+
<h6 id="attribute-i-data-label-"><span><a href="#attribute-i-data-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
170
|
+
|
171
|
+
</div>
|
172
|
+
</div>
|
173
|
+
|
174
|
+
</section>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
179
|
+
<header>
|
180
|
+
<h3>Public Class Methods</h3>
|
181
|
+
</header>
|
182
|
+
|
183
|
+
|
184
|
+
<div id="method-c-new" class="method-detail ">
|
185
|
+
|
186
|
+
<div class="method-heading">
|
187
|
+
<span class="method-name">new</span><span
|
188
|
+
class="method-args">(path)</span>
|
189
|
+
|
190
|
+
<span class="method-click-advice">click to toggle source</span>
|
191
|
+
|
192
|
+
</div>
|
193
|
+
|
194
|
+
|
195
|
+
<div class="method-description">
|
196
|
+
|
197
|
+
<h6 id="method-c-new-label-"><span><a href="#method-c-new-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
198
|
+
|
199
|
+
<p>Methods</p>
|
200
|
+
|
201
|
+
<h6 id="method-c-new-label-"><span><a href="#method-c-new-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
202
|
+
<hr>
|
203
|
+
|
204
|
+
<p>initialize method</p>
|
205
|
+
|
206
|
+
<p>Initializes configuration from a flat file. @param path The filepath to the
|
207
|
+
config YAML @return void</p>
|
208
|
+
<hr>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<div class="method-source-code" id="new-source">
|
214
|
+
<pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 26</span>
|
215
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">path</span>)
|
216
|
+
<span class="ruby-identifier">_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
|
217
|
+
<span class="ruby-ivar">@config_path</span> = <span class="ruby-identifier">_path</span>
|
218
|
+
<span class="ruby-ivar">@data</span> = {}
|
219
|
+
|
220
|
+
<span class="ruby-keyword">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">_path</span>)
|
221
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_file</span>(<span class="ruby-identifier">_path</span>)
|
222
|
+
<span class="ruby-ivar">@data</span>.<span class="ruby-identifier">deep_merge!</span>(<span class="ruby-identifier">data</span>).<span class="ruby-identifier">deep_symbolize_keys!</span>
|
223
|
+
<span class="ruby-keyword">end</span>
|
224
|
+
<span class="ruby-keyword">end</span></pre>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
</div>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
</section>
|
236
|
+
|
237
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
238
|
+
<header>
|
239
|
+
<h3>Public Instance Methods</h3>
|
240
|
+
</header>
|
241
|
+
|
242
|
+
|
243
|
+
<div id="method-i-add_section" class="method-detail ">
|
244
|
+
|
245
|
+
<div class="method-heading">
|
246
|
+
<span class="method-name">add_section</span><span
|
247
|
+
class="method-args">(section_name)</span>
|
248
|
+
|
249
|
+
<span class="method-click-advice">click to toggle source</span>
|
250
|
+
|
251
|
+
</div>
|
252
|
+
|
253
|
+
|
254
|
+
<div class="method-description">
|
255
|
+
|
256
|
+
<hr>
|
257
|
+
|
258
|
+
<p><a href="Configurator.html#method-i-add_section">#add_section</a> method</p>
|
259
|
+
|
260
|
+
<p>Adds a new section to the config file (if it doesn't already exist).
|
261
|
+
@param section_name The section to add @return Void</p>
|
262
|
+
<hr>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
<div class="method-source-code" id="add_section-source">
|
268
|
+
<pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 45</span>
|
269
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_section</span>(<span class="ruby-identifier">section_name</span>)
|
270
|
+
<span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@data</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">section_name</span>)
|
271
|
+
<span class="ruby-ivar">@data</span>[<span class="ruby-identifier">section_name</span>] = {}
|
272
|
+
<span class="ruby-keyword">else</span>
|
273
|
+
<span class="ruby-identifier">fail</span> <span class="ruby-node">"Section already exists: #{ section_name }"</span>
|
274
|
+
<span class="ruby-keyword">end</span>
|
275
|
+
<span class="ruby-keyword">end</span></pre>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
</div>
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
</div>
|
284
|
+
|
285
|
+
|
286
|
+
<div id="method-i-delete_section" class="method-detail ">
|
287
|
+
|
288
|
+
<div class="method-heading">
|
289
|
+
<span class="method-name">delete_section</span><span
|
290
|
+
class="method-args">(section_name)</span>
|
291
|
+
|
292
|
+
<span class="method-click-advice">click to toggle source</span>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
|
297
|
+
<div class="method-description">
|
298
|
+
|
299
|
+
<hr>
|
300
|
+
|
301
|
+
<p><a href="Configurator.html#method-i-delete_section">#delete_section</a>
|
302
|
+
method</p>
|
303
|
+
|
304
|
+
<p>Removes a section to the config file (if it exists). @param section_name
|
305
|
+
The section to remove @return Void</p>
|
306
|
+
<hr>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
<div class="method-source-code" id="delete_section-source">
|
312
|
+
<pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 60</span>
|
313
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">delete_section</span>(<span class="ruby-identifier">section_name</span>)
|
314
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">section_name</span>)
|
315
|
+
<span class="ruby-ivar">@data</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">section_name</span>)
|
316
|
+
<span class="ruby-keyword">else</span>
|
317
|
+
<span class="ruby-identifier">fail</span> <span class="ruby-node">"Cannot delete nonexistent section: #{ section_name }"</span>
|
318
|
+
<span class="ruby-keyword">end</span>
|
319
|
+
<span class="ruby-keyword">end</span></pre>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
</div>
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
</div>
|
328
|
+
|
329
|
+
|
330
|
+
<div id="method-i-ingest_prefs" class="method-detail ">
|
331
|
+
|
332
|
+
<div class="method-heading">
|
333
|
+
<span class="method-name">ingest_prefs</span><span
|
334
|
+
class="method-args">(prefs)</span>
|
335
|
+
|
336
|
+
<span class="method-click-advice">click to toggle source</span>
|
337
|
+
|
338
|
+
</div>
|
339
|
+
|
340
|
+
|
341
|
+
<div class="method-description">
|
342
|
+
|
343
|
+
<hr>
|
344
|
+
|
345
|
+
<p><a href="Configurator.html#method-i-ingest_prefs">#ingest_prefs</a> method</p>
|
346
|
+
|
347
|
+
<p>Ingests a <a href="Prefs.html">Prefs</a> class and adds its answers to the
|
348
|
+
configuration data. @param prefs The <a href="Prefs.html">Prefs</a> class
|
349
|
+
to examine @return Void</p>
|
350
|
+
<hr>
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
<div class="method-source-code" id="ingest_prefs-source">
|
356
|
+
<pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 76</span>
|
357
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">ingest_prefs</span>(<span class="ruby-identifier">prefs</span>)
|
358
|
+
<span class="ruby-identifier">fail</span> <span class="ruby-string">'Invaid Prefs class'</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">prefs</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Prefs</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">prefs</span>.<span class="ruby-identifier">answers</span>.<span class="ruby-identifier">nil?</span>
|
359
|
+
<span class="ruby-identifier">prefs</span>.<span class="ruby-identifier">answers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
360
|
+
<span class="ruby-identifier">add_section</span>(<span class="ruby-identifier">p</span>[<span class="ruby-value">:section</span>]) <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">p</span>[<span class="ruby-value">:section</span>])
|
361
|
+
<span class="ruby-ivar">@data</span>[<span class="ruby-identifier">p</span>[<span class="ruby-value">:section</span>]].<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">p</span>[<span class="ruby-value">:key</span>] =<span class="ruby-operator">></span> <span class="ruby-identifier">p</span>[<span class="ruby-value">:answer</span>])
|
362
|
+
<span class="ruby-keyword">end</span>
|
363
|
+
<span class="ruby-keyword">end</span></pre>
|
364
|
+
</div>
|
365
|
+
|
366
|
+
</div>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
<div id="method-i-method_missing" class="method-detail ">
|
375
|
+
|
376
|
+
<div class="method-heading">
|
377
|
+
<span class="method-name">method_missing</span><span
|
378
|
+
class="method-args">(name, *args, &block)</span>
|
379
|
+
|
380
|
+
<span class="method-click-advice">click to toggle source</span>
|
381
|
+
|
382
|
+
</div>
|
383
|
+
|
384
|
+
|
385
|
+
<div class="method-description">
|
386
|
+
|
387
|
+
<hr>
|
388
|
+
|
389
|
+
<p><a href="Configurator.html#method-i-method_missing">#method_missing</a>
|
390
|
+
method</p>
|
391
|
+
|
392
|
+
<p>Allows this module to return data from the config <a
|
393
|
+
href="../Hash.html">Hash</a> when given a method name that matches a key.
|
394
|
+
@param name @param *args @param &block @return <a
|
395
|
+
href="../Hash.html">Hash</a></p>
|
396
|
+
<hr>
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
<div class="method-source-code" id="method_missing-source">
|
402
|
+
<pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 94</span>
|
403
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
404
|
+
<span class="ruby-ivar">@data</span>[<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span>] <span class="ruby-operator">||</span> <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_sym</span> =<span class="ruby-operator">></span> {})
|
405
|
+
<span class="ruby-keyword">end</span></pre>
|
406
|
+
</div>
|
407
|
+
|
408
|
+
</div>
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
</div>
|
414
|
+
|
415
|
+
|
416
|
+
<div id="method-i-reset" class="method-detail ">
|
417
|
+
|
418
|
+
<div class="method-heading">
|
419
|
+
<span class="method-name">reset</span><span
|
420
|
+
class="method-args">()</span>
|
421
|
+
|
422
|
+
<span class="method-click-advice">click to toggle source</span>
|
423
|
+
|
424
|
+
</div>
|
425
|
+
|
426
|
+
|
427
|
+
<div class="method-description">
|
428
|
+
|
429
|
+
<hr>
|
430
|
+
|
431
|
+
<p>reset method</p>
|
432
|
+
|
433
|
+
<p>Clears the configuration data. @return Void</p>
|
434
|
+
<hr>
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
<div class="method-source-code" id="reset-source">
|
440
|
+
<pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 104</span>
|
441
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset</span>
|
442
|
+
<span class="ruby-ivar">@data</span> = {}
|
443
|
+
<span class="ruby-keyword">end</span></pre>
|
444
|
+
</div>
|
445
|
+
|
446
|
+
</div>
|
447
|
+
|
448
|
+
|
449
|
+
|
450
|
+
|
451
|
+
</div>
|
452
|
+
|
453
|
+
|
454
|
+
<div id="method-i-save" class="method-detail ">
|
455
|
+
|
456
|
+
<div class="method-heading">
|
457
|
+
<span class="method-name">save</span><span
|
458
|
+
class="method-args">()</span>
|
459
|
+
|
460
|
+
<span class="method-click-advice">click to toggle source</span>
|
461
|
+
|
462
|
+
</div>
|
463
|
+
|
464
|
+
|
465
|
+
<div class="method-description">
|
466
|
+
|
467
|
+
<hr>
|
468
|
+
|
469
|
+
<p>save method</p>
|
470
|
+
|
471
|
+
<p>Saves the configuration data to the previously stored flat file. @return
|
472
|
+
Void</p>
|
473
|
+
<hr>
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
<div class="method-source-code" id="save-source">
|
479
|
+
<pre><span class="ruby-comment"># File lib/cliutils/configurator.rb, line 115</span>
|
480
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">save</span>
|
481
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-ivar">@config_path</span>, <span class="ruby-string">'w'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">write</span>(<span class="ruby-ivar">@data</span>.<span class="ruby-identifier">deep_stringify_keys</span>.<span class="ruby-identifier">to_yaml</span>) }
|
482
|
+
<span class="ruby-keyword">end</span></pre>
|
483
|
+
</div>
|
484
|
+
|
485
|
+
</div>
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
</div>
|
491
|
+
|
492
|
+
|
493
|
+
</section>
|
494
|
+
|
495
|
+
</section>
|
496
|
+
</main>
|
497
|
+
|
498
|
+
|
499
|
+
<footer id="validator-badges" role="contentinfo">
|
500
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
501
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
502
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
503
|
+
</footer>
|
504
|
+
|