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
data/html/CLIUtils.html
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module CLIUtils - 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="module">
|
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
|
+
|
58
|
+
<div id="class-metadata">
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
</div>
|
65
|
+
</nav>
|
66
|
+
|
67
|
+
<main role="main" aria-labelledby="module-CLIUtils">
|
68
|
+
<h1 id="module-CLIUtils" class="module">
|
69
|
+
module CLIUtils
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<section class="description">
|
73
|
+
|
74
|
+
</section>
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<section class="constants-list">
|
86
|
+
<header>
|
87
|
+
<h3>Constants</h3>
|
88
|
+
</header>
|
89
|
+
<dl>
|
90
|
+
|
91
|
+
<dt id="VERSION">VERSION
|
92
|
+
|
93
|
+
<dd>
|
94
|
+
|
95
|
+
|
96
|
+
</dl>
|
97
|
+
</section>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
</section>
|
104
|
+
</main>
|
105
|
+
|
106
|
+
|
107
|
+
<footer id="validator-badges" role="contentinfo">
|
108
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
109
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
110
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
111
|
+
</footer>
|
112
|
+
|
data/html/Hash.html
ADDED
@@ -0,0 +1,453 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Hash - 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-Hash-label-"></a>
|
62
|
+
<li><a href="#class-Hash-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-i-deep_merge-21">#deep_merge!</a>
|
86
|
+
|
87
|
+
<li ><a href="#method-i-deep_stringify_keys">#deep_stringify_keys</a>
|
88
|
+
|
89
|
+
<li ><a href="#method-i-deep_stringify_keys-21">#deep_stringify_keys!</a>
|
90
|
+
|
91
|
+
<li ><a href="#method-i-deep_symbolize_keys">#deep_symbolize_keys</a>
|
92
|
+
|
93
|
+
<li ><a href="#method-i-deep_symbolize_keys-21">#deep_symbolize_keys!</a>
|
94
|
+
|
95
|
+
<li ><a href="#method-i-deep_transform_keys">#deep_transform_keys</a>
|
96
|
+
|
97
|
+
<li ><a href="#method-i-deep_transform_keys-21">#deep_transform_keys!</a>
|
98
|
+
|
99
|
+
</ul>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
</nav>
|
104
|
+
|
105
|
+
<main role="main" aria-labelledby="class-Hash">
|
106
|
+
<h1 id="class-Hash" class="class">
|
107
|
+
class Hash
|
108
|
+
</h1>
|
109
|
+
|
110
|
+
<section class="description">
|
111
|
+
|
112
|
+
<h6 id="class-Hash-label-"><span><a href="#class-Hash-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
113
|
+
|
114
|
+
<p><a href="Hash.html">Hash</a> Class</p>
|
115
|
+
|
116
|
+
<p>Contains many convenient methods borred from Rails <a
|
117
|
+
href="http://api.rubyonrails.org/classes/Hash.html">api.rubyonrails.org/classes/Hash.html</a></p>
|
118
|
+
|
119
|
+
<h6 id="class-Hash-label-"><span><a href="#class-Hash-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
|
+
|
135
|
+
|
136
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
137
|
+
<header>
|
138
|
+
<h3>Public Instance Methods</h3>
|
139
|
+
</header>
|
140
|
+
|
141
|
+
|
142
|
+
<div id="method-i-deep_merge-21" class="method-detail ">
|
143
|
+
|
144
|
+
<div class="method-heading">
|
145
|
+
<span class="method-name">deep_merge!</span><span
|
146
|
+
class="method-args">(other_hash, &block)</span>
|
147
|
+
|
148
|
+
<span class="method-click-advice">click to toggle source</span>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
|
155
|
+
<h6 id="method-i-deep_merge-21-label-"><span><a href="#method-i-deep_merge-21-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
156
|
+
|
157
|
+
<p>Methods</p>
|
158
|
+
|
159
|
+
<h6 id="method-i-deep_merge-21-label-"><span><a href="#method-i-deep_merge-21-label-">¶</a> <a href="#documentation">↑</a></span></h6>
|
160
|
+
<hr>
|
161
|
+
|
162
|
+
<p>deep_merge! method</p>
|
163
|
+
|
164
|
+
<p>Deep merges a hash into the current one. @param other_hash The hash to
|
165
|
+
merge in @param &block @return <a href="Hash.html">Hash</a></p>
|
166
|
+
<hr>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
<div class="method-source-code" id="deep_merge-21-source">
|
172
|
+
<pre><span class="ruby-comment"># File lib/cliutils/ext/Hash+Extensions.rb, line 19</span>
|
173
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_merge!</span>(<span class="ruby-identifier">other_hash</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
174
|
+
<span class="ruby-identifier">other_hash</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
175
|
+
<span class="ruby-identifier">tv</span> = <span class="ruby-keyword">self</span>[<span class="ruby-identifier">k</span>]
|
176
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">tv</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
|
177
|
+
<span class="ruby-keyword">self</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">tv</span>.<span class="ruby-identifier">deep_merge</span>(<span class="ruby-identifier">v</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
178
|
+
<span class="ruby-keyword">else</span>
|
179
|
+
<span class="ruby-keyword">self</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">block</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">tv</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">tv</span>, <span class="ruby-identifier">v</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">v</span>
|
180
|
+
<span class="ruby-keyword">end</span>
|
181
|
+
<span class="ruby-keyword">end</span>
|
182
|
+
<span class="ruby-keyword">self</span>
|
183
|
+
<span class="ruby-keyword">end</span></pre>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
<div id="method-i-deep_stringify_keys" class="method-detail ">
|
195
|
+
|
196
|
+
<div class="method-heading">
|
197
|
+
<span class="method-name">deep_stringify_keys</span><span
|
198
|
+
class="method-args">()</span>
|
199
|
+
|
200
|
+
<span class="method-click-advice">click to toggle source</span>
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
<div class="method-description">
|
206
|
+
|
207
|
+
<hr>
|
208
|
+
|
209
|
+
<p><a href="Hash.html#method-i-deep_stringify_keys">#deep_stringify_keys</a>
|
210
|
+
method</p>
|
211
|
+
|
212
|
+
<p>Recursively turns all <a href="Hash.html">Hash</a> keys into strings and
|
213
|
+
returns the new <a href="Hash.html">Hash</a>. @return <a
|
214
|
+
href="Hash.html">Hash</a></p>
|
215
|
+
<hr>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
<div class="method-source-code" id="deep_stringify_keys-source">
|
221
|
+
<pre><span class="ruby-comment"># File lib/cliutils/ext/Hash+Extensions.rb, line 38</span>
|
222
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_stringify_keys</span>
|
223
|
+
<span class="ruby-identifier">deep_transform_keys</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> }
|
224
|
+
<span class="ruby-keyword">end</span></pre>
|
225
|
+
</div>
|
226
|
+
|
227
|
+
</div>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
</div>
|
233
|
+
|
234
|
+
|
235
|
+
<div id="method-i-deep_stringify_keys-21" class="method-detail ">
|
236
|
+
|
237
|
+
<div class="method-heading">
|
238
|
+
<span class="method-name">deep_stringify_keys!</span><span
|
239
|
+
class="method-args">()</span>
|
240
|
+
|
241
|
+
<span class="method-click-advice">click to toggle source</span>
|
242
|
+
|
243
|
+
</div>
|
244
|
+
|
245
|
+
|
246
|
+
<div class="method-description">
|
247
|
+
|
248
|
+
<hr>
|
249
|
+
|
250
|
+
<p><a href="Hash.html#method-i-deep_symbolize_keys">#deep_symbolize_keys</a>!
|
251
|
+
method</p>
|
252
|
+
|
253
|
+
<p>Same as <a
|
254
|
+
href="Hash.html#method-i-deep_stringify_keys">#deep_stringify_keys</a>, but
|
255
|
+
destructively alters the original <a href="Hash.html">Hash</a>. @return <a
|
256
|
+
href="Hash.html">Hash</a></p>
|
257
|
+
<hr>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
<div class="method-source-code" id="deep_stringify_keys-21-source">
|
263
|
+
<pre><span class="ruby-comment"># File lib/cliutils/ext/Hash+Extensions.rb, line 49</span>
|
264
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_stringify_keys!</span>
|
265
|
+
<span class="ruby-identifier">deep_transform_keys!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> }
|
266
|
+
<span class="ruby-keyword">end</span></pre>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
</div>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
</div>
|
275
|
+
|
276
|
+
|
277
|
+
<div id="method-i-deep_symbolize_keys" class="method-detail ">
|
278
|
+
|
279
|
+
<div class="method-heading">
|
280
|
+
<span class="method-name">deep_symbolize_keys</span><span
|
281
|
+
class="method-args">()</span>
|
282
|
+
|
283
|
+
<span class="method-click-advice">click to toggle source</span>
|
284
|
+
|
285
|
+
</div>
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-description">
|
289
|
+
|
290
|
+
<hr>
|
291
|
+
|
292
|
+
<p><a href="Hash.html#method-i-deep_symbolize_keys">#deep_symbolize_keys</a>
|
293
|
+
method</p>
|
294
|
+
|
295
|
+
<p>Recursively turns all <a href="Hash.html">Hash</a> keys into symbols and
|
296
|
+
returns the new <a href="Hash.html">Hash</a>. @return <a
|
297
|
+
href="Hash.html">Hash</a></p>
|
298
|
+
<hr>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
<div class="method-source-code" id="deep_symbolize_keys-source">
|
304
|
+
<pre><span class="ruby-comment"># File lib/cliutils/ext/Hash+Extensions.rb, line 60</span>
|
305
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_symbolize_keys</span>
|
306
|
+
<span class="ruby-identifier">deep_transform_keys</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">key</span> }
|
307
|
+
<span class="ruby-keyword">end</span></pre>
|
308
|
+
</div>
|
309
|
+
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
|
318
|
+
<div id="method-i-deep_symbolize_keys-21" class="method-detail ">
|
319
|
+
|
320
|
+
<div class="method-heading">
|
321
|
+
<span class="method-name">deep_symbolize_keys!</span><span
|
322
|
+
class="method-args">()</span>
|
323
|
+
|
324
|
+
<span class="method-click-advice">click to toggle source</span>
|
325
|
+
|
326
|
+
</div>
|
327
|
+
|
328
|
+
|
329
|
+
<div class="method-description">
|
330
|
+
|
331
|
+
<hr>
|
332
|
+
|
333
|
+
<p><a href="Hash.html#method-i-deep_symbolize_keys">#deep_symbolize_keys</a>!
|
334
|
+
method</p>
|
335
|
+
|
336
|
+
<p>Same as <a
|
337
|
+
href="Hash.html#method-i-deep_symbolize_keys">#deep_symbolize_keys</a>, but
|
338
|
+
destructively alters the original <a href="Hash.html">Hash</a>. @return <a
|
339
|
+
href="Hash.html">Hash</a></p>
|
340
|
+
<hr>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
<div class="method-source-code" id="deep_symbolize_keys-21-source">
|
346
|
+
<pre><span class="ruby-comment"># File lib/cliutils/ext/Hash+Extensions.rb, line 71</span>
|
347
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_symbolize_keys!</span>
|
348
|
+
<span class="ruby-identifier">deep_transform_keys!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_sym</span> <span class="ruby-keyword">rescue</span> <span class="ruby-identifier">key</span> }
|
349
|
+
<span class="ruby-keyword">end</span></pre>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
</div>
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
</div>
|
358
|
+
|
359
|
+
|
360
|
+
<div id="method-i-deep_transform_keys" class="method-detail ">
|
361
|
+
|
362
|
+
<div class="method-heading">
|
363
|
+
<span class="method-name">deep_transform_keys</span><span
|
364
|
+
class="method-args">(&block)</span>
|
365
|
+
|
366
|
+
<span class="method-click-advice">click to toggle source</span>
|
367
|
+
|
368
|
+
</div>
|
369
|
+
|
370
|
+
|
371
|
+
<div class="method-description">
|
372
|
+
|
373
|
+
<hr>
|
374
|
+
|
375
|
+
<p><a href="Hash.html#method-i-deep_transform_keys">#deep_transform_keys</a>
|
376
|
+
method</p>
|
377
|
+
|
378
|
+
<p>Generic method to perform recursive operations on a <a
|
379
|
+
href="Hash.html">Hash</a>. @return <a href="Hash.html">Hash</a></p>
|
380
|
+
<hr>
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
<div class="method-source-code" id="deep_transform_keys-source">
|
386
|
+
<pre><span class="ruby-comment"># File lib/cliutils/ext/Hash+Extensions.rb, line 82</span>
|
387
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_transform_keys</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
388
|
+
<span class="ruby-identifier">_deep_transform_keys_in_object</span>(<span class="ruby-keyword">self</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
389
|
+
<span class="ruby-keyword">end</span></pre>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
</div>
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
<div id="method-i-deep_transform_keys-21" class="method-detail ">
|
401
|
+
|
402
|
+
<div class="method-heading">
|
403
|
+
<span class="method-name">deep_transform_keys!</span><span
|
404
|
+
class="method-args">(&block)</span>
|
405
|
+
|
406
|
+
<span class="method-click-advice">click to toggle source</span>
|
407
|
+
|
408
|
+
</div>
|
409
|
+
|
410
|
+
|
411
|
+
<div class="method-description">
|
412
|
+
|
413
|
+
<hr>
|
414
|
+
|
415
|
+
<p><a href="Hash.html#method-i-deep_transform_keys">#deep_transform_keys</a>!
|
416
|
+
method</p>
|
417
|
+
|
418
|
+
<p>Same as <a
|
419
|
+
href="Hash.html#method-i-deep_transform_keys">#deep_transform_keys</a>, but
|
420
|
+
destructively alters the original <a href="Hash.html">Hash</a>. @return <a
|
421
|
+
href="Hash.html">Hash</a></p>
|
422
|
+
<hr>
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
<div class="method-source-code" id="deep_transform_keys-21-source">
|
428
|
+
<pre><span class="ruby-comment"># File lib/cliutils/ext/Hash+Extensions.rb, line 93</span>
|
429
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">deep_transform_keys!</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
430
|
+
<span class="ruby-identifier">_deep_transform_keys_in_object!</span>(<span class="ruby-keyword">self</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
431
|
+
<span class="ruby-keyword">end</span></pre>
|
432
|
+
</div>
|
433
|
+
|
434
|
+
</div>
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
</div>
|
440
|
+
|
441
|
+
|
442
|
+
</section>
|
443
|
+
|
444
|
+
</section>
|
445
|
+
</main>
|
446
|
+
|
447
|
+
|
448
|
+
<footer id="validator-badges" role="contentinfo">
|
449
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
450
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
451
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
452
|
+
</footer>
|
453
|
+
|