workbook 0.4.13 → 0.4.14
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 -1
- data/lib/workbook/modules/cell.rb +14 -0
- data/lib/workbook/version.rb +1 -1
- data/test/test_modules_cache.rb +14 -14
- data/test/test_modules_cell.rb +9 -2
- data/test/test_readers_xls_reader.rb +1 -1
- metadata +4 -46
- data/doc/RubyXL/Cell.html +0 -201
- data/doc/RubyXL/Workbook.html +0 -449
- data/doc/RubyXL.html +0 -128
- data/doc/Workbook/Book.html +0 -1852
- data/doc/Workbook/Cell.html +0 -1553
- data/doc/Workbook/Format.html +0 -1168
- data/doc/Workbook/Modules/RawObjectsStorage.html +0 -502
- data/doc/Workbook/Modules/TableDiffSort.html +0 -758
- data/doc/Workbook/Modules/TypeParser.html +0 -1063
- data/doc/Workbook/Modules.html +0 -117
- data/doc/Workbook/NilValue.html +0 -434
- data/doc/Workbook/Readers/CsvReader.html +0 -324
- data/doc/Workbook/Readers/OdsReader.html +0 -1066
- data/doc/Workbook/Readers/TxtReader.html +0 -236
- data/doc/Workbook/Readers/XlsReader.html +0 -378
- data/doc/Workbook/Readers/XlsShared.html +0 -188
- data/doc/Workbook/Readers/XlsxReader.html +0 -302
- data/doc/Workbook/Readers.html +0 -117
- data/doc/Workbook/Row.html +0 -2392
- data/doc/Workbook/Sheet.html +0 -875
- data/doc/Workbook/Table.html +0 -1732
- data/doc/Workbook/Template.html +0 -634
- data/doc/Workbook/Writers/CsvTableWriter.html +0 -200
- data/doc/Workbook/Writers/HtmlWriter.html +0 -407
- data/doc/Workbook/Writers/XlsWriter.html +0 -905
- data/doc/Workbook/Writers.html +0 -117
- data/doc/Workbook.html +0 -142
- data/doc/_index.html +0 -381
- data/doc/class_list.html +0 -53
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -338
- data/doc/file.README.html +0 -245
- data/doc/file_list.html +0 -55
- data/doc/frames.html +0 -28
- data/doc/index.html +0 -245
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -173
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1308
- data/doc/top-level-namespace.html +0 -112
- data/test/artifacts/floats_problem.xls +0 -0
@@ -1,1063 +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
|
-
Module: Workbook::Modules::TypeParser
|
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 (T)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../../Workbook.html" title="Workbook (module)">Workbook</a></span></span> » <span class='title'><span class='object_link'><a href="../Modules.html" title="Workbook::Modules (module)">Modules</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">TypeParser</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: Workbook::Modules::TypeParser
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
<dt class="r1">Included in:</dt>
|
81
|
-
<dd class="r1"><span class='object_link'><a href="../Cell.html" title="Workbook::Cell (class)">Cell</a></span></dd>
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
<dt class="r2 last">Defined in:</dt>
|
86
|
-
<dd class="r2 last">lib/workbook/modules/type_parser.rb</dd>
|
87
|
-
|
88
|
-
</dl>
|
89
|
-
<div class="clear"></div>
|
90
|
-
|
91
|
-
<h2>Overview</h2><div class="docstring">
|
92
|
-
<div class="discussion">
|
93
|
-
|
94
|
-
<p>Adds type parsing capabilities to e.g. a Cell.</p>
|
95
|
-
|
96
|
-
|
97
|
-
</div>
|
98
|
-
</div>
|
99
|
-
<div class="tags">
|
100
|
-
|
101
|
-
|
102
|
-
</div>
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<h2>
|
111
|
-
Instance Method Summary
|
112
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
113
|
-
</h2>
|
114
|
-
|
115
|
-
<ul class="summary">
|
116
|
-
|
117
|
-
<li class="public ">
|
118
|
-
<span class="summary_signature">
|
119
|
-
|
120
|
-
<a href="#clean%21-instance_method" title="#clean! (instance method)">- (Object) <strong>clean!</strong>(options = {}) </a>
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
</span>
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
135
|
-
|
136
|
-
</li>
|
137
|
-
|
138
|
-
|
139
|
-
<li class="public ">
|
140
|
-
<span class="summary_signature">
|
141
|
-
|
142
|
-
<a href="#parse-instance_method" title="#parse (instance method)">- (Object) <strong>parse</strong>(options = {}) </a>
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
</span>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
<span class="summary_desc"><div class='inline'>
|
157
|
-
<p>Returns the parsed value (retrieved by calling #value).</p>
|
158
|
-
</div></span>
|
159
|
-
|
160
|
-
</li>
|
161
|
-
|
162
|
-
|
163
|
-
<li class="public ">
|
164
|
-
<span class="summary_signature">
|
165
|
-
|
166
|
-
<a href="#parse%21-instance_method" title="#parse! (instance method)">- (Object) <strong>parse!</strong>(options = {}) </a>
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
</span>
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
181
|
-
|
182
|
-
</li>
|
183
|
-
|
184
|
-
|
185
|
-
<li class="public ">
|
186
|
-
<span class="summary_signature">
|
187
|
-
|
188
|
-
<a href="#string_boolean_converter-instance_method" title="#string_boolean_converter (instance method)">- (Object) <strong>string_boolean_converter</strong> </a>
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
</span>
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
<span class="summary_desc"><div class='inline'>
|
203
|
-
<p>converts 'true' or 'false' strings in `true` or `false` values return
|
204
|
-
[Proc] that returns a boolean value if it is considered as such.</p>
|
205
|
-
</div></span>
|
206
|
-
|
207
|
-
</li>
|
208
|
-
|
209
|
-
|
210
|
-
<li class="public ">
|
211
|
-
<span class="summary_signature">
|
212
|
-
|
213
|
-
<a href="#string_cleaner-instance_method" title="#string_cleaner (instance method)">- (Object) <strong>string_cleaner</strong> </a>
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
</span>
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
228
|
-
|
229
|
-
</li>
|
230
|
-
|
231
|
-
|
232
|
-
<li class="public ">
|
233
|
-
<span class="summary_signature">
|
234
|
-
|
235
|
-
<a href="#string_integer_converter-instance_method" title="#string_integer_converter (instance method)">- (Object) <strong>string_integer_converter</strong> </a>
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
</span>
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
250
|
-
|
251
|
-
</li>
|
252
|
-
|
253
|
-
|
254
|
-
<li class="public ">
|
255
|
-
<span class="summary_signature">
|
256
|
-
|
257
|
-
<a href="#string_nil_converter-instance_method" title="#string_nil_converter (instance method)">- (Object) <strong>string_nil_converter</strong> </a>
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
</span>
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
272
|
-
|
273
|
-
</li>
|
274
|
-
|
275
|
-
|
276
|
-
<li class="public ">
|
277
|
-
<span class="summary_signature">
|
278
|
-
|
279
|
-
<a href="#string_optimistic_date_converter-instance_method" title="#string_optimistic_date_converter (instance method)">- (Object) <strong>string_optimistic_date_converter</strong> </a>
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
</span>
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
294
|
-
|
295
|
-
</li>
|
296
|
-
|
297
|
-
|
298
|
-
<li class="public ">
|
299
|
-
<span class="summary_signature">
|
300
|
-
|
301
|
-
<a href="#string_parsers-instance_method" title="#string_parsers (instance method)">- (Array<Symbol>) <strong>string_parsers</strong> </a>
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
</span>
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
<span class="summary_desc"><div class='inline'>
|
316
|
-
<p>Return the different active string parsers.</p>
|
317
|
-
</div></span>
|
318
|
-
|
319
|
-
</li>
|
320
|
-
|
321
|
-
|
322
|
-
<li class="public ">
|
323
|
-
<span class="summary_signature">
|
324
|
-
|
325
|
-
<a href="#string_parsers%3D-instance_method" title="#string_parsers= (instance method)">- (Array<Symbol>) <strong>string_parsers=</strong>(parsers) </a>
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
</span>
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
<span class="summary_desc"><div class='inline'>
|
340
|
-
<p>Set the list of string parsers.</p>
|
341
|
-
</div></span>
|
342
|
-
|
343
|
-
</li>
|
344
|
-
|
345
|
-
|
346
|
-
<li class="public ">
|
347
|
-
<span class="summary_signature">
|
348
|
-
|
349
|
-
<a href="#string_parsers_as_procs-instance_method" title="#string_parsers_as_procs (instance method)">- (Array<Proc>) <strong>string_parsers_as_procs</strong> </a>
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
</span>
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
<span class="summary_desc"><div class='inline'>
|
364
|
-
<p>Return the different active string parsers.</p>
|
365
|
-
</div></span>
|
366
|
-
|
367
|
-
</li>
|
368
|
-
|
369
|
-
|
370
|
-
<li class="public ">
|
371
|
-
<span class="summary_signature">
|
372
|
-
|
373
|
-
<a href="#strip_win_chars-instance_method" title="#strip_win_chars (instance method)">- (Object) <strong>strip_win_chars</strong>(csv_raw) </a>
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
</span>
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
<span class="summary_desc"><div class='inline'>
|
388
|
-
<p>Cleans a text file from all kinds of different ways of representing new
|
389
|
-
lines.</p>
|
390
|
-
</div></span>
|
391
|
-
|
392
|
-
</li>
|
393
|
-
|
394
|
-
|
395
|
-
</ul>
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
<div id="instance_method_details" class="method_details_list">
|
401
|
-
<h2>Instance Method Details</h2>
|
402
|
-
|
403
|
-
|
404
|
-
<div class="method_details first">
|
405
|
-
<h3 class="signature first" id="clean!-instance_method">
|
406
|
-
|
407
|
-
- (<tt>Object</tt>) <strong>clean!</strong>(options = {})
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
</h3><table class="source_code">
|
414
|
-
<tr>
|
415
|
-
<td>
|
416
|
-
<pre class="lines">
|
417
|
-
|
418
|
-
|
419
|
-
50
|
420
|
-
51
|
421
|
-
52</pre>
|
422
|
-
</td>
|
423
|
-
<td>
|
424
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 50</span>
|
425
|
-
|
426
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_clean!'>clean!</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
|
427
|
-
<span class='id identifier rubyid_parse!'>parse!</span> <span class='id identifier rubyid_options'>options</span>
|
428
|
-
<span class='kw'>end</span></pre>
|
429
|
-
</td>
|
430
|
-
</tr>
|
431
|
-
</table>
|
432
|
-
</div>
|
433
|
-
|
434
|
-
<div class="method_details ">
|
435
|
-
<h3 class="signature " id="parse-instance_method">
|
436
|
-
|
437
|
-
- (<tt>Object</tt>) <strong>parse</strong>(options = {})
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
</h3><div class="docstring">
|
444
|
-
<div class="discussion">
|
445
|
-
|
446
|
-
<p>Returns the parsed value (retrieved by calling #value)</p>
|
447
|
-
|
448
|
-
|
449
|
-
</div>
|
450
|
-
</div>
|
451
|
-
<div class="tags">
|
452
|
-
|
453
|
-
<p class="tag_title">Returns:</p>
|
454
|
-
<ul class="return">
|
455
|
-
|
456
|
-
<li>
|
457
|
-
|
458
|
-
|
459
|
-
<span class='type'>(<tt>Object</tt>)</span>
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
—
|
464
|
-
<div class='inline'>
|
465
|
-
<p>The parsed object, ideally a date or integer when found to be a such…</p>
|
466
|
-
</div>
|
467
|
-
|
468
|
-
</li>
|
469
|
-
|
470
|
-
</ul>
|
471
|
-
|
472
|
-
</div><table class="source_code">
|
473
|
-
<tr>
|
474
|
-
<td>
|
475
|
-
<pre class="lines">
|
476
|
-
|
477
|
-
|
478
|
-
34
|
479
|
-
35
|
480
|
-
36
|
481
|
-
37
|
482
|
-
38
|
483
|
-
39
|
484
|
-
40
|
485
|
-
41
|
486
|
-
42
|
487
|
-
43
|
488
|
-
44</pre>
|
489
|
-
</td>
|
490
|
-
<td>
|
491
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 34</span>
|
492
|
-
|
493
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
|
494
|
-
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='symbol'>:detect_date</span><span class='op'>=></span><span class='kw'>false</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
495
|
-
<span class='id identifier rubyid_string_parsers'>string_parsers</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='symbol'>:string_optimistic_date_converter</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:detect_date</span><span class='rbracket'>]</span>
|
496
|
-
<span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span>
|
497
|
-
<span class='id identifier rubyid_string_parsers_as_procs'>string_parsers_as_procs</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>
|
498
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
|
499
|
-
<span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='id identifier rubyid_p'>p</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span>
|
500
|
-
<span class='kw'>end</span>
|
501
|
-
<span class='kw'>end</span>
|
502
|
-
<span class='id identifier rubyid_v'>v</span>
|
503
|
-
<span class='kw'>end</span></pre>
|
504
|
-
</td>
|
505
|
-
</tr>
|
506
|
-
</table>
|
507
|
-
</div>
|
508
|
-
|
509
|
-
<div class="method_details ">
|
510
|
-
<h3 class="signature " id="parse!-instance_method">
|
511
|
-
|
512
|
-
- (<tt>Object</tt>) <strong>parse!</strong>(options = {})
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
</h3><table class="source_code">
|
519
|
-
<tr>
|
520
|
-
<td>
|
521
|
-
<pre class="lines">
|
522
|
-
|
523
|
-
|
524
|
-
46
|
525
|
-
47
|
526
|
-
48</pre>
|
527
|
-
</td>
|
528
|
-
<td>
|
529
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 46</span>
|
530
|
-
|
531
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_parse!'>parse!</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
|
532
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
533
|
-
<span class='kw'>end</span></pre>
|
534
|
-
</td>
|
535
|
-
</tr>
|
536
|
-
</table>
|
537
|
-
</div>
|
538
|
-
|
539
|
-
<div class="method_details ">
|
540
|
-
<h3 class="signature " id="string_boolean_converter-instance_method">
|
541
|
-
|
542
|
-
- (<tt>Object</tt>) <strong>string_boolean_converter</strong>
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
</h3><div class="docstring">
|
549
|
-
<div class="discussion">
|
550
|
-
|
551
|
-
<p>converts 'true' or 'false' strings in `true` or `false` values return
|
552
|
-
[Proc] that returns a boolean value if it is considered as such</p>
|
553
|
-
|
554
|
-
|
555
|
-
</div>
|
556
|
-
</div>
|
557
|
-
<div class="tags">
|
558
|
-
|
559
|
-
|
560
|
-
</div><table class="source_code">
|
561
|
-
<tr>
|
562
|
-
<td>
|
563
|
-
<pre class="lines">
|
564
|
-
|
565
|
-
|
566
|
-
110
|
567
|
-
111
|
568
|
-
112
|
569
|
-
113
|
570
|
-
114
|
571
|
-
115
|
572
|
-
116
|
573
|
-
117
|
574
|
-
118
|
575
|
-
119
|
576
|
-
120</pre>
|
577
|
-
</td>
|
578
|
-
<td>
|
579
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 110</span>
|
580
|
-
|
581
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_boolean_converter'>string_boolean_converter</span>
|
582
|
-
<span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
583
|
-
<span class='id identifier rubyid_dv'>dv</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
|
584
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_dv'>dv</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>true</span><span class='tstring_end'>"</span></span>
|
585
|
-
<span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='kw'>true</span>
|
586
|
-
<span class='kw'>elsif</span> <span class='id identifier rubyid_dv'>dv</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>false</span><span class='tstring_end'>"</span></span>
|
587
|
-
<span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='kw'>false</span>
|
588
|
-
<span class='kw'>end</span>
|
589
|
-
<span class='id identifier rubyid_v'>v</span>
|
590
|
-
<span class='kw'>end</span>
|
591
|
-
<span class='kw'>end</span></pre>
|
592
|
-
</td>
|
593
|
-
</tr>
|
594
|
-
</table>
|
595
|
-
</div>
|
596
|
-
|
597
|
-
<div class="method_details ">
|
598
|
-
<h3 class="signature " id="string_cleaner-instance_method">
|
599
|
-
|
600
|
-
- (<tt>Object</tt>) <strong>string_cleaner</strong>
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
</h3><table class="source_code">
|
607
|
-
<tr>
|
608
|
-
<td>
|
609
|
-
<pre class="lines">
|
610
|
-
|
611
|
-
|
612
|
-
54
|
613
|
-
55
|
614
|
-
56
|
615
|
-
57
|
616
|
-
58
|
617
|
-
59</pre>
|
618
|
-
</td>
|
619
|
-
<td>
|
620
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 54</span>
|
621
|
-
|
622
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_cleaner'>string_cleaner</span>
|
623
|
-
<span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
624
|
-
<span class='id identifier rubyid_v'>v</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
|
625
|
-
<span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mailto:</span><span class='tstring_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>
|
626
|
-
<span class='kw'>end</span>
|
627
|
-
<span class='kw'>end</span></pre>
|
628
|
-
</td>
|
629
|
-
</tr>
|
630
|
-
</table>
|
631
|
-
</div>
|
632
|
-
|
633
|
-
<div class="method_details ">
|
634
|
-
<h3 class="signature " id="string_integer_converter-instance_method">
|
635
|
-
|
636
|
-
- (<tt>Object</tt>) <strong>string_integer_converter</strong>
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
</h3><table class="source_code">
|
643
|
-
<tr>
|
644
|
-
<td>
|
645
|
-
<pre class="lines">
|
646
|
-
|
647
|
-
|
648
|
-
67
|
649
|
-
68
|
650
|
-
69
|
651
|
-
70
|
652
|
-
71
|
653
|
-
72
|
654
|
-
73
|
655
|
-
74
|
656
|
-
75</pre>
|
657
|
-
</td>
|
658
|
-
<td>
|
659
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 67</span>
|
660
|
-
|
661
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_integer_converter'>string_integer_converter</span>
|
662
|
-
<span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
663
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>==</span> <span class='id identifier rubyid_v'>v</span>
|
664
|
-
<span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
665
|
-
<span class='kw'>else</span>
|
666
|
-
<span class='id identifier rubyid_v'>v</span>
|
667
|
-
<span class='kw'>end</span>
|
668
|
-
<span class='kw'>end</span>
|
669
|
-
<span class='kw'>end</span></pre>
|
670
|
-
</td>
|
671
|
-
</tr>
|
672
|
-
</table>
|
673
|
-
</div>
|
674
|
-
|
675
|
-
<div class="method_details ">
|
676
|
-
<h3 class="signature " id="string_nil_converter-instance_method">
|
677
|
-
|
678
|
-
- (<tt>Object</tt>) <strong>string_nil_converter</strong>
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
</h3><table class="source_code">
|
685
|
-
<tr>
|
686
|
-
<td>
|
687
|
-
<pre class="lines">
|
688
|
-
|
689
|
-
|
690
|
-
61
|
691
|
-
62
|
692
|
-
63
|
693
|
-
64
|
694
|
-
65</pre>
|
695
|
-
</td>
|
696
|
-
<td>
|
697
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 61</span>
|
698
|
-
|
699
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_nil_converter'>string_nil_converter</span>
|
700
|
-
<span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
701
|
-
<span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span>
|
702
|
-
<span class='kw'>end</span>
|
703
|
-
<span class='kw'>end</span></pre>
|
704
|
-
</td>
|
705
|
-
</tr>
|
706
|
-
</table>
|
707
|
-
</div>
|
708
|
-
|
709
|
-
<div class="method_details ">
|
710
|
-
<h3 class="signature " id="string_optimistic_date_converter-instance_method">
|
711
|
-
|
712
|
-
- (<tt>Object</tt>) <strong>string_optimistic_date_converter</strong>
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
</h3><table class="source_code">
|
719
|
-
<tr>
|
720
|
-
<td>
|
721
|
-
<pre class="lines">
|
722
|
-
|
723
|
-
|
724
|
-
77
|
725
|
-
78
|
726
|
-
79
|
727
|
-
80
|
728
|
-
81
|
729
|
-
82
|
730
|
-
83
|
731
|
-
84
|
732
|
-
85
|
733
|
-
86
|
734
|
-
87
|
735
|
-
88
|
736
|
-
89
|
737
|
-
90
|
738
|
-
91
|
739
|
-
92
|
740
|
-
93
|
741
|
-
94
|
742
|
-
95
|
743
|
-
96
|
744
|
-
97
|
745
|
-
98
|
746
|
-
99
|
747
|
-
100
|
748
|
-
101
|
749
|
-
102
|
750
|
-
103
|
751
|
-
104
|
752
|
-
105
|
753
|
-
106</pre>
|
754
|
-
</td>
|
755
|
-
<td>
|
756
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 77</span>
|
757
|
-
|
758
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_optimistic_date_converter'>string_optimistic_date_converter</span>
|
759
|
-
<span class='id identifier rubyid_proc'>proc</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span>
|
760
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
761
|
-
<span class='id identifier rubyid_starts_with_nr'>starts_with_nr</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_chars'>chars</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>==</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_chars'>chars</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span> <span class='comment'>#it should at least start with a number...
|
762
|
-
</span> <span class='id identifier rubyid_no_spaced_dash'>no_spaced_dash</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</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> <span class='op'>?</span> <span class='kw'>false</span> <span class='op'>:</span> <span class='kw'>true</span>
|
763
|
-
<span class='id identifier rubyid_min_two_dashes'>min_two_dashes</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</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><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>></span> <span class='int'>1</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span>
|
764
|
-
<span class='id identifier rubyid_min_two_dashes'>min_two_dashes</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</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><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>></span> <span class='int'>1</span> <span class='op'>?</span> <span class='kw'>true</span> <span class='op'>:</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_min_two_dashes'>min_two_dashes</span> <span class='op'>==</span> <span class='kw'>false</span>
|
765
|
-
|
766
|
-
<span class='id identifier rubyid_normal_date_length'>normal_date_length</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'><=</span> <span class='int'>25</span>
|
767
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_no_spaced_dash'>no_spaced_dash</span> <span class='kw'>and</span> <span class='id identifier rubyid_starts_with_nr'>starts_with_nr</span> <span class='kw'>and</span> <span class='id identifier rubyid_normal_date_length'>normal_date_length</span> <span class='kw'>and</span> <span class='id identifier rubyid_min_two_dashes'>min_two_dashes</span>
|
768
|
-
<span class='kw'>begin</span>
|
769
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>10</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>DateTime</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span>
|
770
|
-
<span class='kw'>rescue</span> <span class='const'>ArgumentError</span>
|
771
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='id identifier rubyid_v'>v</span>
|
772
|
-
<span class='kw'>end</span>
|
773
|
-
<span class='kw'>begin</span>
|
774
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>?</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>:</span> <span class='id identifier rubyid_rv'>rv</span> <span class='comment'># disqualify if it is only based on the first number
|
775
|
-
</span> <span class='kw'>rescue</span> <span class='const'>ArgumentError</span>
|
776
|
-
<span class='kw'>end</span>
|
777
|
-
<span class='comment'># try strptime with format 'mm/dd/yyyy'
|
778
|
-
</span> <span class='kw'>if</span> <span class='id identifier rubyid_rv'>rv</span> <span class='op'>==</span> <span class='id identifier rubyid_v'>v</span> <span class='op'>&&</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\d{1,2}[\/-]\d{1,2}[\/-]\d{4}</span><span class='regexp_end'>/</span></span> <span class='op'>=~</span> <span class='id identifier rubyid_v'>v</span>
|
779
|
-
<span class='kw'>begin</span>
|
780
|
-
<span class='id identifier rubyid_rv'>rv</span> <span class='op'>=</span> <span class='const'>Date</span><span class='period'>.</span><span class='id identifier rubyid_strptime'>strptime</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>%m/%d/%Y</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
781
|
-
<span class='kw'>rescue</span> <span class='const'>ArgumentError</span>
|
782
|
-
<span class='kw'>end</span>
|
783
|
-
<span class='kw'>end</span>
|
784
|
-
<span class='kw'>end</span>
|
785
|
-
<span class='id identifier rubyid_rv'>rv</span>
|
786
|
-
<span class='kw'>end</span>
|
787
|
-
<span class='kw'>end</span></pre>
|
788
|
-
</td>
|
789
|
-
</tr>
|
790
|
-
</table>
|
791
|
-
</div>
|
792
|
-
|
793
|
-
<div class="method_details ">
|
794
|
-
<h3 class="signature " id="string_parsers-instance_method">
|
795
|
-
|
796
|
-
- (<tt>Array<Symbol></tt>) <strong>string_parsers</strong>
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
</h3><div class="docstring">
|
803
|
-
<div class="discussion">
|
804
|
-
|
805
|
-
<p>Return the different active string parsers</p>
|
806
|
-
|
807
|
-
|
808
|
-
</div>
|
809
|
-
</div>
|
810
|
-
<div class="tags">
|
811
|
-
|
812
|
-
<p class="tag_title">Returns:</p>
|
813
|
-
<ul class="return">
|
814
|
-
|
815
|
-
<li>
|
816
|
-
|
817
|
-
|
818
|
-
<span class='type'>(<tt>Array<Symbol></tt>)</span>
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
—
|
823
|
-
<div class='inline'>
|
824
|
-
<p>A list of parsers</p>
|
825
|
-
</div>
|
826
|
-
|
827
|
-
</li>
|
828
|
-
|
829
|
-
</ul>
|
830
|
-
|
831
|
-
</div><table class="source_code">
|
832
|
-
<tr>
|
833
|
-
<td>
|
834
|
-
<pre class="lines">
|
835
|
-
|
836
|
-
|
837
|
-
15
|
838
|
-
16
|
839
|
-
17</pre>
|
840
|
-
</td>
|
841
|
-
<td>
|
842
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 15</span>
|
843
|
-
|
844
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_parsers'>string_parsers</span>
|
845
|
-
<span class='ivar'>@string_parsers</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='symbol'>:string_cleaner</span><span class='comma'>,</span><span class='symbol'>:string_nil_converter</span><span class='comma'>,</span><span class='symbol'>:string_integer_converter</span><span class='comma'>,</span><span class='symbol'>:string_boolean_converter</span><span class='rbracket'>]</span>
|
846
|
-
<span class='kw'>end</span></pre>
|
847
|
-
</td>
|
848
|
-
</tr>
|
849
|
-
</table>
|
850
|
-
</div>
|
851
|
-
|
852
|
-
<div class="method_details ">
|
853
|
-
<h3 class="signature " id="string_parsers=-instance_method">
|
854
|
-
|
855
|
-
- (<tt>Array<Symbol></tt>) <strong>string_parsers=</strong>(parsers)
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
</h3><div class="docstring">
|
862
|
-
<div class="discussion">
|
863
|
-
|
864
|
-
<p>Set the list of string parsers</p>
|
865
|
-
|
866
|
-
|
867
|
-
</div>
|
868
|
-
</div>
|
869
|
-
<div class="tags">
|
870
|
-
<p class="tag_title">Parameters:</p>
|
871
|
-
<ul class="param">
|
872
|
-
|
873
|
-
<li>
|
874
|
-
|
875
|
-
<span class='name'>parsers</span>
|
876
|
-
|
877
|
-
|
878
|
-
<span class='type'>(<tt>Array<Symbol></tt>)</span>
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
—
|
883
|
-
<div class='inline'>
|
884
|
-
<p>A list of parsers</p>
|
885
|
-
</div>
|
886
|
-
|
887
|
-
</li>
|
888
|
-
|
889
|
-
</ul>
|
890
|
-
|
891
|
-
<p class="tag_title">Returns:</p>
|
892
|
-
<ul class="return">
|
893
|
-
|
894
|
-
<li>
|
895
|
-
|
896
|
-
|
897
|
-
<span class='type'>(<tt>Array<Symbol></tt>)</span>
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
—
|
902
|
-
<div class='inline'>
|
903
|
-
<p>A list of parsers</p>
|
904
|
-
</div>
|
905
|
-
|
906
|
-
</li>
|
907
|
-
|
908
|
-
</ul>
|
909
|
-
|
910
|
-
</div><table class="source_code">
|
911
|
-
<tr>
|
912
|
-
<td>
|
913
|
-
<pre class="lines">
|
914
|
-
|
915
|
-
|
916
|
-
22
|
917
|
-
23
|
918
|
-
24</pre>
|
919
|
-
</td>
|
920
|
-
<td>
|
921
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 22</span>
|
922
|
-
|
923
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_parsers='>string_parsers=</span> <span class='id identifier rubyid_parsers'>parsers</span>
|
924
|
-
<span class='ivar'>@string_parsers</span> <span class='op'>=</span> <span class='id identifier rubyid_parsers'>parsers</span>
|
925
|
-
<span class='kw'>end</span></pre>
|
926
|
-
</td>
|
927
|
-
</tr>
|
928
|
-
</table>
|
929
|
-
</div>
|
930
|
-
|
931
|
-
<div class="method_details ">
|
932
|
-
<h3 class="signature " id="string_parsers_as_procs-instance_method">
|
933
|
-
|
934
|
-
- (<tt>Array<Proc></tt>) <strong>string_parsers_as_procs</strong>
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
</h3><div class="docstring">
|
941
|
-
<div class="discussion">
|
942
|
-
|
943
|
-
<p>Return the different active string parsers</p>
|
944
|
-
|
945
|
-
|
946
|
-
</div>
|
947
|
-
</div>
|
948
|
-
<div class="tags">
|
949
|
-
|
950
|
-
<p class="tag_title">Returns:</p>
|
951
|
-
<ul class="return">
|
952
|
-
|
953
|
-
<li>
|
954
|
-
|
955
|
-
|
956
|
-
<span class='type'>(<tt>Array<Proc></tt>)</span>
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
—
|
961
|
-
<div class='inline'>
|
962
|
-
<p>A list of parsers as Procs</p>
|
963
|
-
</div>
|
964
|
-
|
965
|
-
</li>
|
966
|
-
|
967
|
-
</ul>
|
968
|
-
|
969
|
-
</div><table class="source_code">
|
970
|
-
<tr>
|
971
|
-
<td>
|
972
|
-
<pre class="lines">
|
973
|
-
|
974
|
-
|
975
|
-
28
|
976
|
-
29
|
977
|
-
30</pre>
|
978
|
-
</td>
|
979
|
-
<td>
|
980
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 28</span>
|
981
|
-
|
982
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_string_parsers_as_procs'>string_parsers_as_procs</span>
|
983
|
-
<span class='id identifier rubyid_string_parsers'>string_parsers</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_c'>c</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Proc</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_c'>c</span> <span class='op'>:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_c'>c</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
984
|
-
<span class='kw'>end</span></pre>
|
985
|
-
</td>
|
986
|
-
</tr>
|
987
|
-
</table>
|
988
|
-
</div>
|
989
|
-
|
990
|
-
<div class="method_details ">
|
991
|
-
<h3 class="signature " id="strip_win_chars-instance_method">
|
992
|
-
|
993
|
-
- (<tt>Object</tt>) <strong>strip_win_chars</strong>(csv_raw)
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
</h3><div class="docstring">
|
1000
|
-
<div class="discussion">
|
1001
|
-
|
1002
|
-
<p>Cleans a text file from all kinds of different ways of representing new
|
1003
|
-
lines</p>
|
1004
|
-
|
1005
|
-
|
1006
|
-
</div>
|
1007
|
-
</div>
|
1008
|
-
<div class="tags">
|
1009
|
-
<p class="tag_title">Parameters:</p>
|
1010
|
-
<ul class="param">
|
1011
|
-
|
1012
|
-
<li>
|
1013
|
-
|
1014
|
-
<span class='name'>csv_raw</span>
|
1015
|
-
|
1016
|
-
|
1017
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
—
|
1022
|
-
<div class='inline'>
|
1023
|
-
<p>a raw csv string</p>
|
1024
|
-
</div>
|
1025
|
-
|
1026
|
-
</li>
|
1027
|
-
|
1028
|
-
</ul>
|
1029
|
-
|
1030
|
-
|
1031
|
-
</div><table class="source_code">
|
1032
|
-
<tr>
|
1033
|
-
<td>
|
1034
|
-
<pre class="lines">
|
1035
|
-
|
1036
|
-
|
1037
|
-
9
|
1038
|
-
10
|
1039
|
-
11</pre>
|
1040
|
-
</td>
|
1041
|
-
<td>
|
1042
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/modules/type_parser.rb', line 9</span>
|
1043
|
-
|
1044
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_strip_win_chars'>strip_win_chars</span> <span class='id identifier rubyid_csv_raw'>csv_raw</span>
|
1045
|
-
<span class='id identifier rubyid_csv_raw'>csv_raw</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'>(\n\r|\r\n|\r)</span><span class='regexp_end'>/</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
1046
|
-
<span class='kw'>end</span></pre>
|
1047
|
-
</td>
|
1048
|
-
</tr>
|
1049
|
-
</table>
|
1050
|
-
</div>
|
1051
|
-
|
1052
|
-
</div>
|
1053
|
-
|
1054
|
-
</div>
|
1055
|
-
|
1056
|
-
<div id="footer">
|
1057
|
-
Generated on Sun May 19 23:16:29 2013 by
|
1058
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1059
|
-
0.8.5.2 (ruby-1.9.3).
|
1060
|
-
</div>
|
1061
|
-
|
1062
|
-
</body>
|
1063
|
-
</html>
|