blackbox 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/.gitignore +15 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +374 -0
- data/README.md +34 -0
- data/Rakefile +31 -0
- data/blackbox.gemspec +25 -0
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json +323 -0
- data/coverage/assets/0.7.1/application.css +1110 -0
- data/coverage/assets/0.7.1/application.js +626 -0
- data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
- data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
- data/coverage/assets/0.7.1/favicon_green.png +0 -0
- data/coverage/assets/0.7.1/favicon_red.png +0 -0
- data/coverage/assets/0.7.1/favicon_yellow.png +0 -0
- data/coverage/assets/0.7.1/loading.gif +0 -0
- data/coverage/assets/0.7.1/magnify.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +2080 -0
- data/doc/BB.html +129 -0
- data/doc/BB/Crypto.html +1145 -0
- data/doc/BB/Hash.html +441 -0
- data/doc/BB/String.html +240 -0
- data/doc/_index.html +155 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +338 -0
- data/doc/file.README.html +104 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +104 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +124 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/blackbox.rb +4 -0
- data/lib/blackbox/crypto.rb +99 -0
- data/lib/blackbox/hash.rb +49 -0
- data/lib/blackbox/string.rb +17 -0
- data/lib/blackbox/version.rb +3 -0
- data/spec/blackbox_spec.rb +9 -0
- data/spec/crypto_spec.rb +70 -0
- data/spec/hash_spec.rb +51 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/string_spec.rb +13 -0
- metadata +184 -0
data/doc/BB/Hash.html
ADDED
@@ -0,0 +1,441 @@
|
|
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
|
+
Module: BB::Hash
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (H)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../BB.html" title="BB (module)">BB</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Hash</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>Module: BB::Hash
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/blackbox/hash.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
|
90
|
+
<p>Hash utilities.</p>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>
|
107
|
+
Class Method Summary
|
108
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
109
|
+
</h2>
|
110
|
+
|
111
|
+
<ul class="summary">
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#flatten_prop_style-class_method" title="flatten_prop_style (class method)">+ (Hash) <strong>flatten_prop_style</strong>(input = {}, opts = {}, output = {}) </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<span class="summary_desc"><div class='inline'>
|
131
|
+
<p>Recursively flatten a hash to property-style format.</p>
|
132
|
+
</div></span>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
<li class="public ">
|
138
|
+
<span class="summary_signature">
|
139
|
+
|
140
|
+
<a href="#symbolize_keys-class_method" title="symbolize_keys (class method)">+ (Hash) <strong>symbolize_keys</strong>(hash) </a>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
</span>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<span class="summary_desc"><div class='inline'>
|
155
|
+
<p>Symbolize all top level keys.</p>
|
156
|
+
</div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
</ul>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<div id="class_method_details" class="method_details_list">
|
167
|
+
<h2>Class Method Details</h2>
|
168
|
+
|
169
|
+
|
170
|
+
<div class="method_details first">
|
171
|
+
<h3 class="signature first" id="flatten_prop_style-class_method">
|
172
|
+
|
173
|
+
+ (<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>) <strong>flatten_prop_style</strong>(input = {}, opts = {}, output = {})
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</h3><div class="docstring">
|
180
|
+
<div class="discussion">
|
181
|
+
|
182
|
+
<p>Recursively flatten a hash to property-style format. This is a lossy
|
183
|
+
conversion and should only be used for display-purposes.</p>
|
184
|
+
|
185
|
+
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
<div class="tags">
|
189
|
+
|
190
|
+
<div class="examples">
|
191
|
+
<p class="tag_title">Examples:</p>
|
192
|
+
|
193
|
+
|
194
|
+
<pre class="example code"><code>input = { :a => { :b => :c } }
|
195
|
+
BB::Hash.flatten_prop_style(input)
|
196
|
+
=> {"a.b"=>:c}</code></pre>
|
197
|
+
|
198
|
+
|
199
|
+
<pre class="example code"><code>input = { :a => { :b => [:c, :d, :e] } }
|
200
|
+
BB::Hash.flatten_prop_style(input)
|
201
|
+
=> {"a.b"=>"c,d,e"}</code></pre>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
<p class="tag_title">Parameters:</p>
|
205
|
+
<ul class="param">
|
206
|
+
|
207
|
+
<li>
|
208
|
+
|
209
|
+
<span class='name'>input</span>
|
210
|
+
|
211
|
+
|
212
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
213
|
+
|
214
|
+
|
215
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
216
|
+
|
217
|
+
|
218
|
+
—
|
219
|
+
<div class='inline'>
|
220
|
+
<p>Input hash</p>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
</li>
|
224
|
+
|
225
|
+
<li>
|
226
|
+
|
227
|
+
<span class='name'>opts</span>
|
228
|
+
|
229
|
+
|
230
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
231
|
+
|
232
|
+
|
233
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
234
|
+
|
235
|
+
|
236
|
+
—
|
237
|
+
<div class='inline'>
|
238
|
+
<p>Options</p>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
</li>
|
242
|
+
|
243
|
+
<li>
|
244
|
+
|
245
|
+
<span class='name'>output</span>
|
246
|
+
|
247
|
+
|
248
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
249
|
+
|
250
|
+
|
251
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
252
|
+
|
253
|
+
|
254
|
+
—
|
255
|
+
<div class='inline'>
|
256
|
+
<p>(leave this blank)</p>
|
257
|
+
</div>
|
258
|
+
|
259
|
+
</li>
|
260
|
+
|
261
|
+
</ul>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
269
|
+
<ul class="option">
|
270
|
+
|
271
|
+
<li>
|
272
|
+
<span class="name">:delimiter</span>
|
273
|
+
<span class="type">(<tt><span class='object_link'><a href="String.html" title="BB::String (module)">String</a></span></tt>)</span>
|
274
|
+
<span class="default">
|
275
|
+
|
276
|
+
</span>
|
277
|
+
|
278
|
+
— <div class='inline'>
|
279
|
+
<p>Key delimiter (Default: '.')</p>
|
280
|
+
</div>
|
281
|
+
|
282
|
+
</li>
|
283
|
+
|
284
|
+
</ul>
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
<p class="tag_title">Returns:</p>
|
290
|
+
<ul class="return">
|
291
|
+
|
292
|
+
<li>
|
293
|
+
|
294
|
+
|
295
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
—
|
300
|
+
<div class='inline'>
|
301
|
+
<p>Output hash (flattened)</p>
|
302
|
+
</div>
|
303
|
+
|
304
|
+
</li>
|
305
|
+
|
306
|
+
</ul>
|
307
|
+
|
308
|
+
</div><table class="source_code">
|
309
|
+
<tr>
|
310
|
+
<td>
|
311
|
+
<pre class="lines">
|
312
|
+
|
313
|
+
|
314
|
+
32
|
315
|
+
33
|
316
|
+
34
|
317
|
+
35
|
318
|
+
36
|
319
|
+
37
|
320
|
+
38
|
321
|
+
39
|
322
|
+
40
|
323
|
+
41
|
324
|
+
42
|
325
|
+
43
|
326
|
+
44
|
327
|
+
45</pre>
|
328
|
+
</td>
|
329
|
+
<td>
|
330
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/hash.rb', line 32</span>
|
331
|
+
|
332
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_flatten_prop_style'>flatten_prop_style</span><span class='lparen'>(</span><span class='id identifier rubyid_input'>input</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_output'>output</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
333
|
+
<span class='id identifier rubyid_input'>input</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_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
334
|
+
<span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:prefix</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:prefix</span><span class='rbracket'>]</span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:delimiter</span><span class='rbracket'>]</span><span class='op'>||</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='embexpr_end'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
335
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_value'>value</span>
|
336
|
+
<span class='kw'>when</span> <span class='op'>::</span><span class='const'>Hash</span>
|
337
|
+
<span class='id identifier rubyid_flatten_prop_style'>flatten_prop_style</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:prefix</span> <span class='op'>=></span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='symbol'>:delimiter</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_output'>output</span><span class='rparen'>)</span>
|
338
|
+
<span class='kw'>when</span> <span class='const'>Array</span>
|
339
|
+
<span class='id identifier rubyid_output'>output</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><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>,</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
340
|
+
<span class='kw'>else</span>
|
341
|
+
<span class='id identifier rubyid_output'>output</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>
|
342
|
+
<span class='kw'>end</span>
|
343
|
+
<span class='kw'>end</span>
|
344
|
+
<span class='id identifier rubyid_output'>output</span>
|
345
|
+
<span class='kw'>end</span></pre>
|
346
|
+
</td>
|
347
|
+
</tr>
|
348
|
+
</table>
|
349
|
+
</div>
|
350
|
+
|
351
|
+
<div class="method_details ">
|
352
|
+
<h3 class="signature " id="symbolize_keys-class_method">
|
353
|
+
|
354
|
+
+ (<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>) <strong>symbolize_keys</strong>(hash)
|
355
|
+
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</h3><div class="docstring">
|
361
|
+
<div class="discussion">
|
362
|
+
|
363
|
+
<p>Symbolize all top level keys.</p>
|
364
|
+
|
365
|
+
|
366
|
+
</div>
|
367
|
+
</div>
|
368
|
+
<div class="tags">
|
369
|
+
<p class="tag_title">Parameters:</p>
|
370
|
+
<ul class="param">
|
371
|
+
|
372
|
+
<li>
|
373
|
+
|
374
|
+
<span class='name'>hash</span>
|
375
|
+
|
376
|
+
|
377
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
—
|
382
|
+
<div class='inline'>
|
383
|
+
<p>Input hash</p>
|
384
|
+
</div>
|
385
|
+
|
386
|
+
</li>
|
387
|
+
|
388
|
+
</ul>
|
389
|
+
|
390
|
+
<p class="tag_title">Returns:</p>
|
391
|
+
<ul class="return">
|
392
|
+
|
393
|
+
<li>
|
394
|
+
|
395
|
+
|
396
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::Hash (module)">Hash</a></span></tt>)</span>
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
—
|
401
|
+
<div class='inline'>
|
402
|
+
<p>Output hash (with symbolized keys)</p>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
</li>
|
406
|
+
|
407
|
+
</ul>
|
408
|
+
|
409
|
+
</div><table class="source_code">
|
410
|
+
<tr>
|
411
|
+
<td>
|
412
|
+
<pre class="lines">
|
413
|
+
|
414
|
+
|
415
|
+
9
|
416
|
+
10
|
417
|
+
11</pre>
|
418
|
+
</td>
|
419
|
+
<td>
|
420
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/hash.rb', line 9</span>
|
421
|
+
|
422
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_symbolize_keys'>symbolize_keys</span><span class='lparen'>(</span><span class='id identifier rubyid_hash'>hash</span><span class='rparen'>)</span>
|
423
|
+
<span class='id identifier rubyid_hash'>hash</span><span class='period'>.</span><span class='id identifier rubyid_each_with_object'>each_with_object</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='lbrace'>{</span><span class='op'>|</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='id identifier rubyid_h'>h</span><span class='op'>|</span> <span class='id identifier rubyid_h'>h</span><span class='lbracket'>[</span><span class='id identifier rubyid_k'>k</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='id identifier rubyid_v'>v</span><span class='rbrace'>}</span>
|
424
|
+
<span class='kw'>end</span></pre>
|
425
|
+
</td>
|
426
|
+
</tr>
|
427
|
+
</table>
|
428
|
+
</div>
|
429
|
+
|
430
|
+
</div>
|
431
|
+
|
432
|
+
</div>
|
433
|
+
|
434
|
+
<div id="footer">
|
435
|
+
Generated on Sat Mar 30 01:48:11 2013 by
|
436
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
437
|
+
0.8.5.2 (ruby-2.0.0).
|
438
|
+
</div>
|
439
|
+
|
440
|
+
</body>
|
441
|
+
</html>
|
data/doc/BB/String.html
ADDED
@@ -0,0 +1,240 @@
|
|
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
|
+
Module: BB::String
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.5.2
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (S)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../BB.html" title="BB (module)">BB</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">String</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>Module: BB::String
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/blackbox/string.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
|
90
|
+
<p>String utilities.</p>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>
|
107
|
+
Class Method Summary
|
108
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
109
|
+
</h2>
|
110
|
+
|
111
|
+
<ul class="summary">
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#strip_ansi-class_method" title="strip_ansi (class method)">+ (String) <strong>strip_ansi</strong>(text) </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<span class="summary_desc"><div class='inline'>
|
131
|
+
<p>Strip ANSI escape sequences from String.</p>
|
132
|
+
</div></span>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
</ul>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<div id="class_method_details" class="method_details_list">
|
143
|
+
<h2>Class Method Details</h2>
|
144
|
+
|
145
|
+
|
146
|
+
<div class="method_details first">
|
147
|
+
<h3 class="signature first" id="strip_ansi-class_method">
|
148
|
+
|
149
|
+
+ (<tt><span class='object_link'><a href="" title="BB::String (module)">String</a></span></tt>) <strong>strip_ansi</strong>(text)
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
</h3><div class="docstring">
|
156
|
+
<div class="discussion">
|
157
|
+
|
158
|
+
<p>Strip ANSI escape sequences from String.</p>
|
159
|
+
|
160
|
+
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
<div class="tags">
|
164
|
+
<p class="tag_title">Parameters:</p>
|
165
|
+
<ul class="param">
|
166
|
+
|
167
|
+
<li>
|
168
|
+
|
169
|
+
<span class='name'>text</span>
|
170
|
+
|
171
|
+
|
172
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::String (module)">String</a></span></tt>)</span>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
—
|
177
|
+
<div class='inline'>
|
178
|
+
<p>Input string (dirty)</p>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
</li>
|
182
|
+
|
183
|
+
</ul>
|
184
|
+
|
185
|
+
<p class="tag_title">Returns:</p>
|
186
|
+
<ul class="return">
|
187
|
+
|
188
|
+
<li>
|
189
|
+
|
190
|
+
|
191
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="BB::String (module)">String</a></span></tt>)</span>
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
—
|
196
|
+
<div class='inline'>
|
197
|
+
<p>Output string (cleaned)</p>
|
198
|
+
</div>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
</ul>
|
203
|
+
|
204
|
+
</div><table class="source_code">
|
205
|
+
<tr>
|
206
|
+
<td>
|
207
|
+
<pre class="lines">
|
208
|
+
|
209
|
+
|
210
|
+
9
|
211
|
+
10
|
212
|
+
11
|
213
|
+
12
|
214
|
+
13</pre>
|
215
|
+
</td>
|
216
|
+
<td>
|
217
|
+
<pre class="code"><span class="info file"># File 'lib/blackbox/string.rb', line 9</span>
|
218
|
+
|
219
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_strip_ansi'>strip_ansi</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span>
|
220
|
+
<span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span>
|
221
|
+
<span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\x1b(\[|\(|\))[;?0-9]*[0-9A-Za-z]</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span>
|
222
|
+
<span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(\x03|\x1a)</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
223
|
+
<span class='kw'>end</span></pre>
|
224
|
+
</td>
|
225
|
+
</tr>
|
226
|
+
</table>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
</div>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div id="footer">
|
234
|
+
Generated on Sat Mar 30 01:48:12 2013 by
|
235
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
236
|
+
0.8.5.2 (ruby-2.0.0).
|
237
|
+
</div>
|
238
|
+
|
239
|
+
</body>
|
240
|
+
</html>
|