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
data/doc/Workbook/Table.html
DELETED
@@ -1,1732 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: Workbook::Table
|
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>
|
36
|
-
»
|
37
|
-
<span class="title">Table</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Workbook::Table
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName">Array</span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next">Array</li>
|
82
|
-
|
83
|
-
<li class="next">Workbook::Table</li>
|
84
|
-
|
85
|
-
</ul>
|
86
|
-
<a href="#" class="inheritanceTree">show all</a>
|
87
|
-
|
88
|
-
</dd>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<dt class="r2">Includes:</dt>
|
96
|
-
<dd class="r2"><span class='object_link'><a href="Modules/TableDiffSort.html" title="Workbook::Modules::TableDiffSort (module)">Modules::TableDiffSort</a></span>, <span class='object_link'><a href="Writers/CsvTableWriter.html" title="Workbook::Writers::CsvTableWriter (module)">Writers::CsvTableWriter</a></span></dd>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<dt class="r1 last">Defined in:</dt>
|
103
|
-
<dd class="r1 last">lib/workbook/table.rb</dd>
|
104
|
-
|
105
|
-
</dl>
|
106
|
-
<div class="clear"></div>
|
107
|
-
|
108
|
-
<h2>Overview</h2><div class="docstring">
|
109
|
-
<div class="discussion">
|
110
|
-
|
111
|
-
<p>A table is a container of rows and keeps track of the sheet it belongs to
|
112
|
-
and which row is its header. Additionally suport for CSV writing and
|
113
|
-
diffing with another table is included.</p>
|
114
|
-
|
115
|
-
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
<div class="tags">
|
119
|
-
|
120
|
-
|
121
|
-
</div>
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
126
|
-
<ul class="summary">
|
127
|
-
|
128
|
-
<li class="public ">
|
129
|
-
<span class="summary_signature">
|
130
|
-
|
131
|
-
<a href="#header-instance_method" title="#header (instance method)">- (Workbook::Row) <strong>header</strong> </a>
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
</span>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
<span class="summary_desc"><div class='inline'>
|
149
|
-
<p>Returns the header of this table (typically the first row, but can be a
|
150
|
-
different row).</p>
|
151
|
-
</div></span>
|
152
|
-
|
153
|
-
</li>
|
154
|
-
|
155
|
-
|
156
|
-
<li class="public ">
|
157
|
-
<span class="summary_signature">
|
158
|
-
|
159
|
-
<a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong> </a>
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
</span>
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
<span class="summary_desc"><div class='inline'>
|
177
|
-
<p>Returns the value of attribute name.</p>
|
178
|
-
</div></span>
|
179
|
-
|
180
|
-
</li>
|
181
|
-
|
182
|
-
|
183
|
-
<li class="public ">
|
184
|
-
<span class="summary_signature">
|
185
|
-
|
186
|
-
<a href="#sheet-instance_method" title="#sheet (instance method)">- (Workbook::Sheet) <strong>sheet</strong> </a>
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
</span>
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
<span class="summary_desc"><div class='inline'>
|
204
|
-
<p>Returns the sheet this table belongs to, creates a new sheet if none
|
205
|
-
exists.</p>
|
206
|
-
</div></span>
|
207
|
-
|
208
|
-
</li>
|
209
|
-
|
210
|
-
|
211
|
-
</ul>
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
<h2>
|
218
|
-
Instance Method Summary
|
219
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
220
|
-
</h2>
|
221
|
-
|
222
|
-
<ul class="summary">
|
223
|
-
|
224
|
-
<li class="public ">
|
225
|
-
<span class="summary_signature">
|
226
|
-
|
227
|
-
<a href="#%3C%3C-instance_method" title="#<< (instance method)">- (Object) <strong><<</strong>(row) </a>
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
</span>
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
<span class="summary_desc"><div class='inline'>
|
242
|
-
<p>Add row.</p>
|
243
|
-
</div></span>
|
244
|
-
|
245
|
-
</li>
|
246
|
-
|
247
|
-
|
248
|
-
<li class="public ">
|
249
|
-
<span class="summary_signature">
|
250
|
-
|
251
|
-
<a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Workbook::Row, ...) <strong>[]</strong>(index_or_string) </a>
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
</span>
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
<span class="summary_desc"><div class='inline'>
|
266
|
-
<p>Overrides normal Array's []-function with support for symbols that identify
|
267
|
-
a column based on the header-values.</p>
|
268
|
-
</div></span>
|
269
|
-
|
270
|
-
</li>
|
271
|
-
|
272
|
-
|
273
|
-
<li class="public ">
|
274
|
-
<span class="summary_signature">
|
275
|
-
|
276
|
-
<a href="#alpha_index_to_number_index-instance_method" title="#alpha_index_to_number_index (instance method)">- (Integer) <strong>alpha_index_to_number_index</strong>(string) </a>
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
</span>
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
<span class="summary_desc"><div class='inline'>
|
291
|
-
<p>Helps to convert from e.g.</p>
|
292
|
-
</div></span>
|
293
|
-
|
294
|
-
</li>
|
295
|
-
|
296
|
-
|
297
|
-
<li class="public ">
|
298
|
-
<span class="summary_signature">
|
299
|
-
|
300
|
-
<a href="#clone-instance_method" title="#clone (instance method)">- (Workbook::Table) <strong>clone</strong> </a>
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
</span>
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
<span class="summary_desc"><div class='inline'>
|
315
|
-
<p>clones itself <b>and</b> the rows it contains.</p>
|
316
|
-
</div></span>
|
317
|
-
|
318
|
-
</li>
|
319
|
-
|
320
|
-
|
321
|
-
<li class="public ">
|
322
|
-
<span class="summary_signature">
|
323
|
-
|
324
|
-
<a href="#contains_row%3F-instance_method" title="#contains_row? (instance method)">- (Boolean) <strong>contains_row?</strong>(row) </a>
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
</span>
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
<span class="summary_desc"><div class='inline'>
|
339
|
-
<p>Returns true if the row exists in this table.</p>
|
340
|
-
</div></span>
|
341
|
-
|
342
|
-
</li>
|
343
|
-
|
344
|
-
|
345
|
-
<li class="public ">
|
346
|
-
<span class="summary_signature">
|
347
|
-
|
348
|
-
<a href="#create_or_open_row_at-instance_method" title="#create_or_open_row_at (instance method)">- (Object) <strong>create_or_open_row_at</strong>(index) </a>
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
</span>
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
363
|
-
|
364
|
-
</li>
|
365
|
-
|
366
|
-
|
367
|
-
<li class="public ">
|
368
|
-
<span class="summary_signature">
|
369
|
-
|
370
|
-
<a href="#delete_all-instance_method" title="#delete_all (instance method)">- (Workbook::Table) <strong>delete_all</strong> </a>
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
</span>
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
<span class="summary_desc"><div class='inline'>
|
385
|
-
<p>Removes all lines from this table.</p>
|
386
|
-
</div></span>
|
387
|
-
|
388
|
-
</li>
|
389
|
-
|
390
|
-
|
391
|
-
<li class="public ">
|
392
|
-
<span class="summary_signature">
|
393
|
-
|
394
|
-
<a href="#has_contents%3F-instance_method" title="#has_contents? (instance method)">- (Boolean) <strong>has_contents?</strong> </a>
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
</span>
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
409
|
-
|
410
|
-
</li>
|
411
|
-
|
412
|
-
|
413
|
-
<li class="public ">
|
414
|
-
<span class="summary_signature">
|
415
|
-
|
416
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Table) <strong>initialize</strong>(row_cel_values = [], sheet = nil, options = {}) </a>
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
</span>
|
421
|
-
|
422
|
-
|
423
|
-
<span class="note title constructor">constructor</span>
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
<span class="summary_desc"><div class='inline'>
|
433
|
-
<p>A new instance of Table.</p>
|
434
|
-
</div></span>
|
435
|
-
|
436
|
-
</li>
|
437
|
-
|
438
|
-
|
439
|
-
<li class="public ">
|
440
|
-
<span class="summary_signature">
|
441
|
-
|
442
|
-
<a href="#new_row-instance_method" title="#new_row (instance method)">- (Object) <strong>new_row</strong>(cell_values = []) </a>
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
</span>
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
<span class="summary_desc"><div class='inline'>
|
457
|
-
<p>Generates a new row, with optionally predefined cell-values, that is
|
458
|
-
already connected to this table.</p>
|
459
|
-
</div></span>
|
460
|
-
|
461
|
-
</li>
|
462
|
-
|
463
|
-
|
464
|
-
<li class="public ">
|
465
|
-
<span class="summary_signature">
|
466
|
-
|
467
|
-
<a href="#push-instance_method" title="#push (instance method)">- (Object) <strong>push</strong>(row) </a>
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
</span>
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
<span class="summary_desc"><div class='inline'>
|
482
|
-
<p>Add row.</p>
|
483
|
-
</div></span>
|
484
|
-
|
485
|
-
</li>
|
486
|
-
|
487
|
-
|
488
|
-
<li class="public ">
|
489
|
-
<span class="summary_signature">
|
490
|
-
|
491
|
-
<a href="#remove_empty_lines%21-instance_method" title="#remove_empty_lines! (instance method)">- (Object) <strong>remove_empty_lines!</strong> </a>
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
</span>
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
506
|
-
|
507
|
-
</li>
|
508
|
-
|
509
|
-
|
510
|
-
<li class="public ">
|
511
|
-
<span class="summary_signature">
|
512
|
-
|
513
|
-
<a href="#trim-instance_method" title="#trim (instance method)">- (Workbook::Row) <strong>trim</strong>(desired_row_length = nil) </a>
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
</span>
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
<span class="summary_desc"><div class='inline'>
|
528
|
-
<p>remove all the trailing empty-rows (returning a trimmed clone).</p>
|
529
|
-
</div></span>
|
530
|
-
|
531
|
-
</li>
|
532
|
-
|
533
|
-
|
534
|
-
<li class="public ">
|
535
|
-
<span class="summary_signature">
|
536
|
-
|
537
|
-
<a href="#trim%21-instance_method" title="#trim! (instance method)">- (Workbook::Row) <strong>trim!</strong>(desired_row_length = nil) </a>
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
</span>
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
<span class="summary_desc"><div class='inline'>
|
552
|
-
<p>remove all the trailing empty-rows (returning a trimmed self).</p>
|
553
|
-
</div></span>
|
554
|
-
|
555
|
-
</li>
|
556
|
-
|
557
|
-
|
558
|
-
</ul>
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Writers/CsvTableWriter.html" title="Workbook::Writers::CsvTableWriter (module)">Writers::CsvTableWriter</a></span></h3>
|
571
|
-
<p class="inherited"><span class='object_link'><a href="Writers/CsvTableWriter.html#to_csv-instance_method" title="Workbook::Writers::CsvTableWriter#to_csv (method)">#to_csv</a></span></p>
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Modules/TableDiffSort.html" title="Workbook::Modules::TableDiffSort (module)">Modules::TableDiffSort</a></span></h3>
|
582
|
-
<p class="inherited"><span class='object_link'><a href="Modules/TableDiffSort.html#align-instance_method" title="Workbook::Modules::TableDiffSort#align (method)">#align</a></span>, <span class='object_link'><a href="Modules/TableDiffSort.html#align_row-instance_method" title="Workbook::Modules::TableDiffSort#align_row (method)">#align_row</a></span>, <span class='object_link'><a href="Modules/TableDiffSort.html#diff-instance_method" title="Workbook::Modules::TableDiffSort#diff (method)">#diff</a></span>, <span class='object_link'><a href="Modules/TableDiffSort.html#diff_template-instance_method" title="Workbook::Modules::TableDiffSort#diff_template (method)">#diff_template</a></span>, <span class='object_link'><a href="Modules/TableDiffSort.html#insert_placeholder%3F-instance_method" title="Workbook::Modules::TableDiffSort#insert_placeholder? (method)">#insert_placeholder?</a></span>, <span class='object_link'><a href="Modules/TableDiffSort.html#placeholder_row-instance_method" title="Workbook::Modules::TableDiffSort#placeholder_row (method)">#placeholder_row</a></span></p>
|
583
|
-
|
584
|
-
<div id="constructor_details" class="method_details_list">
|
585
|
-
<h2>Constructor Details</h2>
|
586
|
-
|
587
|
-
<div class="method_details first">
|
588
|
-
<h3 class="signature first" id="initialize-instance_method">
|
589
|
-
|
590
|
-
- (<tt><span class='object_link'><a href="" title="Workbook::Table (class)">Table</a></span></tt>) <strong>initialize</strong>(row_cel_values = [], sheet = nil, options = {})
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
</h3><div class="docstring">
|
597
|
-
<div class="discussion">
|
598
|
-
|
599
|
-
<p>A new instance of Table</p>
|
600
|
-
|
601
|
-
|
602
|
-
</div>
|
603
|
-
</div>
|
604
|
-
<div class="tags">
|
605
|
-
|
606
|
-
|
607
|
-
</div><table class="source_code">
|
608
|
-
<tr>
|
609
|
-
<td>
|
610
|
-
<pre class="lines">
|
611
|
-
|
612
|
-
|
613
|
-
15
|
614
|
-
16
|
615
|
-
17
|
616
|
-
18
|
617
|
-
19
|
618
|
-
20
|
619
|
-
21
|
620
|
-
22
|
621
|
-
23
|
622
|
-
24
|
623
|
-
25
|
624
|
-
26</pre>
|
625
|
-
</td>
|
626
|
-
<td>
|
627
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 15</span>
|
628
|
-
|
629
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_row_cel_values'>row_cel_values</span><span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_sheet'>sheet</span><span class='op'>=</span><span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span>
|
630
|
-
<span class='id identifier rubyid_row_cel_values'>row_cel_values</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_row_cel_values'>row_cel_values</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
631
|
-
<span class='id identifier rubyid_row_cel_values'>row_cel_values</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_r'>r</span><span class='op'>|</span>
|
632
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Row</span>
|
633
|
-
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='kw'>self</span>
|
634
|
-
<span class='kw'>else</span>
|
635
|
-
<span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Row</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_r'>r</span><span class='comma'>,</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
636
|
-
<span class='kw'>end</span>
|
637
|
-
<span class='kw'>end</span>
|
638
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_sheet'>sheet</span> <span class='op'>=</span> <span class='id identifier rubyid_sheet'>sheet</span>
|
639
|
-
<span class='comment'># Column data is considered as a 'row' with 'cells' that contain 'formatting'
|
640
|
-
</span><span class='kw'>end</span></pre>
|
641
|
-
</td>
|
642
|
-
</tr>
|
643
|
-
</table>
|
644
|
-
</div>
|
645
|
-
|
646
|
-
</div>
|
647
|
-
|
648
|
-
<div id="instance_attr_details" class="attr_details">
|
649
|
-
<h2>Instance Attribute Details</h2>
|
650
|
-
|
651
|
-
|
652
|
-
<span id="header=-instance_method"></span>
|
653
|
-
<div class="method_details first">
|
654
|
-
<h3 class="signature first" id="header-instance_method">
|
655
|
-
|
656
|
-
- (<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>) <strong>header</strong>
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
</h3><div class="docstring">
|
663
|
-
<div class="discussion">
|
664
|
-
|
665
|
-
<p>Returns the header of this table (typically the first row, but can be a
|
666
|
-
different row). The header row is also used for finding values in a
|
667
|
-
aribrary row.</p>
|
668
|
-
|
669
|
-
|
670
|
-
</div>
|
671
|
-
</div>
|
672
|
-
<div class="tags">
|
673
|
-
|
674
|
-
<p class="tag_title">Returns:</p>
|
675
|
-
<ul class="return">
|
676
|
-
|
677
|
-
<li>
|
678
|
-
|
679
|
-
|
680
|
-
<span class='type'>(<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>)</span>
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
—
|
685
|
-
<div class='inline'>
|
686
|
-
<p>The header</p>
|
687
|
-
</div>
|
688
|
-
|
689
|
-
</li>
|
690
|
-
|
691
|
-
</ul>
|
692
|
-
|
693
|
-
</div><table class="source_code">
|
694
|
-
<tr>
|
695
|
-
<td>
|
696
|
-
<pre class="lines">
|
697
|
-
|
698
|
-
|
699
|
-
32
|
700
|
-
33
|
701
|
-
34</pre>
|
702
|
-
</td>
|
703
|
-
<td>
|
704
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 32</span>
|
705
|
-
|
706
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_header'>header</span>
|
707
|
-
<span class='ivar'>@header</span>
|
708
|
-
<span class='kw'>end</span></pre>
|
709
|
-
</td>
|
710
|
-
</tr>
|
711
|
-
</table>
|
712
|
-
</div>
|
713
|
-
|
714
|
-
|
715
|
-
<span id="name=-instance_method"></span>
|
716
|
-
<div class="method_details ">
|
717
|
-
<h3 class="signature " id="name-instance_method">
|
718
|
-
|
719
|
-
- (<tt>Object</tt>) <strong>name</strong>
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
</h3><div class="docstring">
|
726
|
-
<div class="discussion">
|
727
|
-
|
728
|
-
<p>Returns the value of attribute name</p>
|
729
|
-
|
730
|
-
|
731
|
-
</div>
|
732
|
-
</div>
|
733
|
-
<div class="tags">
|
734
|
-
|
735
|
-
|
736
|
-
</div><table class="source_code">
|
737
|
-
<tr>
|
738
|
-
<td>
|
739
|
-
<pre class="lines">
|
740
|
-
|
741
|
-
|
742
|
-
12
|
743
|
-
13
|
744
|
-
14</pre>
|
745
|
-
</td>
|
746
|
-
<td>
|
747
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 12</span>
|
748
|
-
|
749
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
750
|
-
<span class='ivar'>@name</span>
|
751
|
-
<span class='kw'>end</span></pre>
|
752
|
-
</td>
|
753
|
-
</tr>
|
754
|
-
</table>
|
755
|
-
</div>
|
756
|
-
|
757
|
-
|
758
|
-
<span id="sheet=-instance_method"></span>
|
759
|
-
<div class="method_details ">
|
760
|
-
<h3 class="signature " id="sheet-instance_method">
|
761
|
-
|
762
|
-
- (<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>) <strong>sheet</strong>
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
</h3><div class="docstring">
|
769
|
-
<div class="discussion">
|
770
|
-
|
771
|
-
<p>Returns the sheet this table belongs to, creates a new sheet if none exists</p>
|
772
|
-
|
773
|
-
|
774
|
-
</div>
|
775
|
-
</div>
|
776
|
-
<div class="tags">
|
777
|
-
|
778
|
-
<p class="tag_title">Returns:</p>
|
779
|
-
<ul class="return">
|
780
|
-
|
781
|
-
<li>
|
782
|
-
|
783
|
-
|
784
|
-
<span class='type'>(<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>)</span>
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
—
|
789
|
-
<div class='inline'>
|
790
|
-
<p>The sheet this table belongs to</p>
|
791
|
-
</div>
|
792
|
-
|
793
|
-
</li>
|
794
|
-
|
795
|
-
</ul>
|
796
|
-
|
797
|
-
</div><table class="source_code">
|
798
|
-
<tr>
|
799
|
-
<td>
|
800
|
-
<pre class="lines">
|
801
|
-
|
802
|
-
|
803
|
-
94
|
804
|
-
95
|
805
|
-
96</pre>
|
806
|
-
</td>
|
807
|
-
<td>
|
808
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 94</span>
|
809
|
-
|
810
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_sheet'>sheet</span>
|
811
|
-
<span class='ivar'>@sheet</span>
|
812
|
-
<span class='kw'>end</span></pre>
|
813
|
-
</td>
|
814
|
-
</tr>
|
815
|
-
</table>
|
816
|
-
</div>
|
817
|
-
|
818
|
-
</div>
|
819
|
-
|
820
|
-
|
821
|
-
<div id="instance_method_details" class="method_details_list">
|
822
|
-
<h2>Instance Method Details</h2>
|
823
|
-
|
824
|
-
|
825
|
-
<div class="method_details first">
|
826
|
-
<h3 class="signature first" id="<<-instance_method">
|
827
|
-
|
828
|
-
- (<tt>Object</tt>) <strong><<</strong>(row)
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
</h3><div class="docstring">
|
835
|
-
<div class="discussion">
|
836
|
-
|
837
|
-
<p>Add row</p>
|
838
|
-
|
839
|
-
|
840
|
-
</div>
|
841
|
-
</div>
|
842
|
-
<div class="tags">
|
843
|
-
<p class="tag_title">Parameters:</p>
|
844
|
-
<ul class="param">
|
845
|
-
|
846
|
-
<li>
|
847
|
-
|
848
|
-
<span class='name'>row</span>
|
849
|
-
|
850
|
-
|
851
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Table (class)">Workbook::Table</a></span></tt>, <tt>Array</tt>)</span>
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
—
|
856
|
-
<div class='inline'>
|
857
|
-
<p>to add</p>
|
858
|
-
</div>
|
859
|
-
|
860
|
-
</li>
|
861
|
-
|
862
|
-
</ul>
|
863
|
-
|
864
|
-
|
865
|
-
</div><table class="source_code">
|
866
|
-
<tr>
|
867
|
-
<td>
|
868
|
-
<pre class="lines">
|
869
|
-
|
870
|
-
|
871
|
-
72
|
872
|
-
73
|
873
|
-
74
|
874
|
-
75
|
875
|
-
76</pre>
|
876
|
-
</td>
|
877
|
-
<td>
|
878
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 72</span>
|
879
|
-
|
880
|
-
<span class='kw'>def</span> <span class='op'><<</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
881
|
-
<span class='id identifier rubyid_row'>row</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Row</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Array</span>
|
882
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
883
|
-
<span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_set_table'>set_table</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
884
|
-
<span class='kw'>end</span></pre>
|
885
|
-
</td>
|
886
|
-
</tr>
|
887
|
-
</table>
|
888
|
-
</div>
|
889
|
-
|
890
|
-
<div class="method_details ">
|
891
|
-
<h3 class="signature " id="[]-instance_method">
|
892
|
-
|
893
|
-
- (<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>, ...) <strong>[]</strong>(index_or_string)
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
</h3><div class="docstring">
|
900
|
-
<div class="discussion">
|
901
|
-
|
902
|
-
<p>Overrides normal Array's []-function with support for symbols that identify
|
903
|
-
a column based on the header-values</p>
|
904
|
-
|
905
|
-
|
906
|
-
</div>
|
907
|
-
</div>
|
908
|
-
<div class="tags">
|
909
|
-
|
910
|
-
<div class="examples">
|
911
|
-
<p class="tag_title">Examples:</p>
|
912
|
-
|
913
|
-
|
914
|
-
<p class="example_title"><div class='inline'>
|
915
|
-
<p>Lookup using fixnum or header value encoded as symbol</p>
|
916
|
-
</div></p>
|
917
|
-
|
918
|
-
<pre class="example code"><code><span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='comment'>#=> <Row [a,2,3,4]> (first row)
|
919
|
-
</span><span class='id identifier rubyid_table'>table</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>A1</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='comment'>#=> <Cell value="a"> (first cell of first row)</span></code></pre>
|
920
|
-
|
921
|
-
</div>
|
922
|
-
<p class="tag_title">Parameters:</p>
|
923
|
-
<ul class="param">
|
924
|
-
|
925
|
-
<li>
|
926
|
-
|
927
|
-
<span class='name'>index_or_string</span>
|
928
|
-
|
929
|
-
|
930
|
-
<span class='type'>(<tt>Fixnum</tt>, <tt>String</tt>)</span>
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
—
|
935
|
-
<div class='inline'>
|
936
|
-
<p>to reference to either the row, or the cell</p>
|
937
|
-
</div>
|
938
|
-
|
939
|
-
</li>
|
940
|
-
|
941
|
-
</ul>
|
942
|
-
|
943
|
-
<p class="tag_title">Returns:</p>
|
944
|
-
<ul class="return">
|
945
|
-
|
946
|
-
<li>
|
947
|
-
|
948
|
-
|
949
|
-
<span class='type'>(<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>, <tt><span class='object_link'><a href="Cell.html" title="Workbook::Cell (class)">Workbook::Cell</a></span></tt>, <tt>nil</tt>)</span>
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
</li>
|
954
|
-
|
955
|
-
</ul>
|
956
|
-
|
957
|
-
</div><table class="source_code">
|
958
|
-
<tr>
|
959
|
-
<td>
|
960
|
-
<pre class="lines">
|
961
|
-
|
962
|
-
|
963
|
-
131
|
964
|
-
132
|
965
|
-
133
|
966
|
-
134
|
967
|
-
135
|
968
|
-
136
|
969
|
-
137
|
970
|
-
138
|
971
|
-
139
|
972
|
-
140
|
973
|
-
141
|
974
|
-
142</pre>
|
975
|
-
</td>
|
976
|
-
<td>
|
977
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 131</span>
|
978
|
-
|
979
|
-
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_index_or_string'>index_or_string</span><span class='rparen'>)</span>
|
980
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_index_or_string'>index_or_string</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>String</span>
|
981
|
-
<span class='id identifier rubyid_match'>match</span> <span class='op'>=</span> <span class='id identifier rubyid_index_or_string'>index_or_string</span><span class='period'>.</span><span class='id identifier rubyid_upcase'>upcase</span><span class='period'>.</span><span class='id identifier rubyid_match'>match</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>([A-Z]*)([0-9]*)</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
982
|
-
<span class='id identifier rubyid_cell_index'>cell_index</span> <span class='op'>=</span> <span class='id identifier rubyid_alpha_index_to_number_index'>alpha_index_to_number_index</span><span class='lparen'>(</span><span class='id identifier rubyid_match'>match</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
983
|
-
<span class='id identifier rubyid_row_index'>row_index</span> <span class='op'>=</span> <span class='id identifier rubyid_match'>match</span><span class='lbracket'>[</span><span class='int'>2</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span> <span class='op'>-</span> <span class='int'>1</span>
|
984
|
-
<span class='kw'>return</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_row_index'>row_index</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_cell_index'>cell_index</span><span class='rbracket'>]</span>
|
985
|
-
<span class='kw'>else</span>
|
986
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_index_or_string'>index_or_string</span>
|
987
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_to_a'>to_a</span><span class='lbracket'>[</span><span class='id identifier rubyid_index_or_string'>index_or_string</span><span class='rbracket'>]</span>
|
988
|
-
<span class='kw'>end</span>
|
989
|
-
<span class='kw'>end</span>
|
990
|
-
<span class='kw'>end</span></pre>
|
991
|
-
</td>
|
992
|
-
</tr>
|
993
|
-
</table>
|
994
|
-
</div>
|
995
|
-
|
996
|
-
<div class="method_details ">
|
997
|
-
<h3 class="signature " id="alpha_index_to_number_index-instance_method">
|
998
|
-
|
999
|
-
- (<tt>Integer</tt>) <strong>alpha_index_to_number_index</strong>(string)
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
</h3><div class="docstring">
|
1006
|
-
<div class="discussion">
|
1007
|
-
|
1008
|
-
<p>Helps to convert from e.g. "AA" to 26</p>
|
1009
|
-
|
1010
|
-
|
1011
|
-
</div>
|
1012
|
-
</div>
|
1013
|
-
<div class="tags">
|
1014
|
-
<p class="tag_title">Parameters:</p>
|
1015
|
-
<ul class="param">
|
1016
|
-
|
1017
|
-
<li>
|
1018
|
-
|
1019
|
-
<span class='name'>string</span>
|
1020
|
-
|
1021
|
-
|
1022
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
—
|
1027
|
-
<div class='inline'>
|
1028
|
-
<p>that typically identifies a column</p>
|
1029
|
-
</div>
|
1030
|
-
|
1031
|
-
</li>
|
1032
|
-
|
1033
|
-
</ul>
|
1034
|
-
|
1035
|
-
<p class="tag_title">Returns:</p>
|
1036
|
-
<ul class="return">
|
1037
|
-
|
1038
|
-
<li>
|
1039
|
-
|
1040
|
-
|
1041
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
</li>
|
1046
|
-
|
1047
|
-
</ul>
|
1048
|
-
|
1049
|
-
</div><table class="source_code">
|
1050
|
-
<tr>
|
1051
|
-
<td>
|
1052
|
-
<pre class="lines">
|
1053
|
-
|
1054
|
-
|
1055
|
-
147
|
1056
|
-
148
|
1057
|
-
149
|
1058
|
-
150
|
1059
|
-
151
|
1060
|
-
152
|
1061
|
-
153
|
1062
|
-
154</pre>
|
1063
|
-
</td>
|
1064
|
-
<td>
|
1065
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 147</span>
|
1066
|
-
|
1067
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_alpha_index_to_number_index'>alpha_index_to_number_index</span> <span class='id identifier rubyid_string'>string</span>
|
1068
|
-
<span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_upcase!'>upcase!</span>
|
1069
|
-
<span class='id identifier rubyid_sum'>sum</span> <span class='op'>=</span> <span class='int'>0</span>
|
1070
|
-
<span class='id identifier rubyid_string'>string</span><span class='period'>.</span><span class='id identifier rubyid_chars'>chars</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='kw'>do</span> <span class='op'>|</span> <span class='id identifier rubyid_char'>char</span><span class='comma'>,</span> <span class='id identifier rubyid_char_index'>char_index</span><span class='op'>|</span>
|
1071
|
-
<span class='id identifier rubyid_sum'>sum</span> <span class='op'>=</span> <span class='id identifier rubyid_sum'>sum</span> <span class='op'>*</span> <span class='int'>26</span> <span class='op'>+</span> <span class='id identifier rubyid_char'>char</span><span class='period'>.</span><span class='id identifier rubyid_unpack'>unpack</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>U</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='op'>-</span><span class='int'>64</span>
|
1072
|
-
<span class='kw'>end</span>
|
1073
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_sum'>sum</span><span class='op'>-</span><span class='int'>1</span>
|
1074
|
-
<span class='kw'>end</span></pre>
|
1075
|
-
</td>
|
1076
|
-
</tr>
|
1077
|
-
</table>
|
1078
|
-
</div>
|
1079
|
-
|
1080
|
-
<div class="method_details ">
|
1081
|
-
<h3 class="signature " id="clone-instance_method">
|
1082
|
-
|
1083
|
-
- (<tt><span class='object_link'><a href="" title="Workbook::Table (class)">Workbook::Table</a></span></tt>) <strong>clone</strong>
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
</h3><div class="docstring">
|
1090
|
-
<div class="discussion">
|
1091
|
-
|
1092
|
-
<p>clones itself <b>and</b> the rows it contains</p>
|
1093
|
-
|
1094
|
-
|
1095
|
-
</div>
|
1096
|
-
</div>
|
1097
|
-
<div class="tags">
|
1098
|
-
|
1099
|
-
<p class="tag_title">Returns:</p>
|
1100
|
-
<ul class="return">
|
1101
|
-
|
1102
|
-
<li>
|
1103
|
-
|
1104
|
-
|
1105
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Table (class)">Workbook::Table</a></span></tt>)</span>
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
—
|
1110
|
-
<div class='inline'>
|
1111
|
-
<p>The cloned table</p>
|
1112
|
-
</div>
|
1113
|
-
|
1114
|
-
</li>
|
1115
|
-
|
1116
|
-
</ul>
|
1117
|
-
|
1118
|
-
</div><table class="source_code">
|
1119
|
-
<tr>
|
1120
|
-
<td>
|
1121
|
-
<pre class="lines">
|
1122
|
-
|
1123
|
-
|
1124
|
-
113
|
1125
|
-
114
|
1126
|
-
115
|
1127
|
-
116
|
1128
|
-
117
|
1129
|
-
118
|
1130
|
-
119
|
1131
|
-
120
|
1132
|
-
121</pre>
|
1133
|
-
</td>
|
1134
|
-
<td>
|
1135
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 113</span>
|
1136
|
-
|
1137
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_clone'>clone</span>
|
1138
|
-
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='kw'>self</span>
|
1139
|
-
<span class='id identifier rubyid_c'>c</span> <span class='op'>=</span> <span class='kw'>super</span>
|
1140
|
-
<span class='id identifier rubyid_header_row_index'>header_row_index</span> <span class='op'>=</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_index'>index</span><span class='lparen'>(</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_header'>header</span><span class='rparen'>)</span>
|
1141
|
-
<span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_delete_all'>delete_all</span>
|
1142
|
-
<span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='op'>|</span> <span class='id identifier rubyid_c'>c</span> <span class='op'><<</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span><span class='rbrace'>}</span>
|
1143
|
-
<span class='id identifier rubyid_c'>c</span><span class='period'>.</span><span class='id identifier rubyid_header'>header</span> <span class='op'>=</span> <span class='id identifier rubyid_c'>c</span><span class='lbracket'>[</span><span class='id identifier rubyid_header_row_index'>header_row_index</span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_header_row_index'>header_row_index</span>
|
1144
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_c'>c</span>
|
1145
|
-
<span class='kw'>end</span></pre>
|
1146
|
-
</td>
|
1147
|
-
</tr>
|
1148
|
-
</table>
|
1149
|
-
</div>
|
1150
|
-
|
1151
|
-
<div class="method_details ">
|
1152
|
-
<h3 class="signature " id="contains_row?-instance_method">
|
1153
|
-
|
1154
|
-
- (<tt>Boolean</tt>) <strong>contains_row?</strong>(row)
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
</h3><div class="docstring">
|
1161
|
-
<div class="discussion">
|
1162
|
-
|
1163
|
-
<p>Returns true if the row exists in this table</p>
|
1164
|
-
|
1165
|
-
|
1166
|
-
</div>
|
1167
|
-
</div>
|
1168
|
-
<div class="tags">
|
1169
|
-
<p class="tag_title">Parameters:</p>
|
1170
|
-
<ul class="param">
|
1171
|
-
|
1172
|
-
<li>
|
1173
|
-
|
1174
|
-
<span class='name'>row</span>
|
1175
|
-
|
1176
|
-
|
1177
|
-
<span class='type'>(<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>)</span>
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
—
|
1182
|
-
<div class='inline'>
|
1183
|
-
<p>to test for</p>
|
1184
|
-
</div>
|
1185
|
-
|
1186
|
-
</li>
|
1187
|
-
|
1188
|
-
</ul>
|
1189
|
-
|
1190
|
-
<p class="tag_title">Returns:</p>
|
1191
|
-
<ul class="return">
|
1192
|
-
|
1193
|
-
<li>
|
1194
|
-
|
1195
|
-
|
1196
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
—
|
1201
|
-
<div class='inline'>
|
1202
|
-
<p>whether the row exist in this table</p>
|
1203
|
-
</div>
|
1204
|
-
|
1205
|
-
</li>
|
1206
|
-
|
1207
|
-
</ul>
|
1208
|
-
<p class="tag_title">Raises:</p>
|
1209
|
-
<ul class="raise">
|
1210
|
-
|
1211
|
-
<li>
|
1212
|
-
|
1213
|
-
|
1214
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
</li>
|
1219
|
-
|
1220
|
-
</ul>
|
1221
|
-
|
1222
|
-
</div><table class="source_code">
|
1223
|
-
<tr>
|
1224
|
-
<td>
|
1225
|
-
<pre class="lines">
|
1226
|
-
|
1227
|
-
|
1228
|
-
86
|
1229
|
-
87
|
1230
|
-
88
|
1231
|
-
89</pre>
|
1232
|
-
</td>
|
1233
|
-
<td>
|
1234
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 86</span>
|
1235
|
-
|
1236
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_contains_row?'>contains_row?</span> <span class='id identifier rubyid_row'>row</span>
|
1237
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>table should be a Workbook::Row (you passed a </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbrace'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Row</span><span class='rparen'>)</span>
|
1238
|
-
<span class='kw'>self</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_r'>r</span><span class='op'>|</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_object_id'>object_id</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_object_id'>object_id</span>
|
1239
|
-
<span class='kw'>end</span></pre>
|
1240
|
-
</td>
|
1241
|
-
</tr>
|
1242
|
-
</table>
|
1243
|
-
</div>
|
1244
|
-
|
1245
|
-
<div class="method_details ">
|
1246
|
-
<h3 class="signature " id="create_or_open_row_at-instance_method">
|
1247
|
-
|
1248
|
-
- (<tt>Object</tt>) <strong>create_or_open_row_at</strong>(index)
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
</h3><table class="source_code">
|
1255
|
-
<tr>
|
1256
|
-
<td>
|
1257
|
-
<pre class="lines">
|
1258
|
-
|
1259
|
-
|
1260
|
-
48
|
1261
|
-
49
|
1262
|
-
50
|
1263
|
-
51
|
1264
|
-
52
|
1265
|
-
53
|
1266
|
-
54
|
1267
|
-
55</pre>
|
1268
|
-
</td>
|
1269
|
-
<td>
|
1270
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 48</span>
|
1271
|
-
|
1272
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_create_or_open_row_at'>create_or_open_row_at</span> <span class='id identifier rubyid_index'>index</span>
|
1273
|
-
<span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span>
|
1274
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_r'>r</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
1275
|
-
<span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Row</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1276
|
-
<span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_table'>table</span><span class='op'>=</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
1277
|
-
<span class='kw'>end</span>
|
1278
|
-
<span class='id identifier rubyid_r'>r</span>
|
1279
|
-
<span class='kw'>end</span></pre>
|
1280
|
-
</td>
|
1281
|
-
</tr>
|
1282
|
-
</table>
|
1283
|
-
</div>
|
1284
|
-
|
1285
|
-
<div class="method_details ">
|
1286
|
-
<h3 class="signature " id="delete_all-instance_method">
|
1287
|
-
|
1288
|
-
- (<tt><span class='object_link'><a href="" title="Workbook::Table (class)">Workbook::Table</a></span></tt>) <strong>delete_all</strong>
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
</h3><div class="docstring">
|
1295
|
-
<div class="discussion">
|
1296
|
-
|
1297
|
-
<p>Removes all lines from this table</p>
|
1298
|
-
|
1299
|
-
|
1300
|
-
</div>
|
1301
|
-
</div>
|
1302
|
-
<div class="tags">
|
1303
|
-
|
1304
|
-
<p class="tag_title">Returns:</p>
|
1305
|
-
<ul class="return">
|
1306
|
-
|
1307
|
-
<li>
|
1308
|
-
|
1309
|
-
|
1310
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Table (class)">Workbook::Table</a></span></tt>)</span>
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
—
|
1315
|
-
<div class='inline'>
|
1316
|
-
<p>(self)</p>
|
1317
|
-
</div>
|
1318
|
-
|
1319
|
-
</li>
|
1320
|
-
|
1321
|
-
</ul>
|
1322
|
-
|
1323
|
-
</div><table class="source_code">
|
1324
|
-
<tr>
|
1325
|
-
<td>
|
1326
|
-
<pre class="lines">
|
1327
|
-
|
1328
|
-
|
1329
|
-
106
|
1330
|
-
107
|
1331
|
-
108</pre>
|
1332
|
-
</td>
|
1333
|
-
<td>
|
1334
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 106</span>
|
1335
|
-
|
1336
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_delete_all'>delete_all</span>
|
1337
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span> <span class='kw'>true</span><span class='rbrace'>}</span>
|
1338
|
-
<span class='kw'>end</span></pre>
|
1339
|
-
</td>
|
1340
|
-
</tr>
|
1341
|
-
</table>
|
1342
|
-
</div>
|
1343
|
-
|
1344
|
-
<div class="method_details ">
|
1345
|
-
<h3 class="signature " id="has_contents?-instance_method">
|
1346
|
-
|
1347
|
-
- (<tt>Boolean</tt>) <strong>has_contents?</strong>
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
</h3><div class="docstring">
|
1354
|
-
<div class="discussion">
|
1355
|
-
|
1356
|
-
|
1357
|
-
</div>
|
1358
|
-
</div>
|
1359
|
-
<div class="tags">
|
1360
|
-
|
1361
|
-
<p class="tag_title">Returns:</p>
|
1362
|
-
<ul class="return">
|
1363
|
-
|
1364
|
-
<li>
|
1365
|
-
|
1366
|
-
|
1367
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
</li>
|
1372
|
-
|
1373
|
-
</ul>
|
1374
|
-
|
1375
|
-
</div><table class="source_code">
|
1376
|
-
<tr>
|
1377
|
-
<td>
|
1378
|
-
<pre class="lines">
|
1379
|
-
|
1380
|
-
|
1381
|
-
78
|
1382
|
-
79
|
1383
|
-
80</pre>
|
1384
|
-
</td>
|
1385
|
-
<td>
|
1386
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 78</span>
|
1387
|
-
|
1388
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_has_contents?'>has_contents?</span>
|
1389
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span><span class='period'>.</span><span class='id identifier rubyid_remove_empty_lines!'>remove_empty_lines!</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>!=</span> <span class='int'>0</span>
|
1390
|
-
<span class='kw'>end</span></pre>
|
1391
|
-
</td>
|
1392
|
-
</tr>
|
1393
|
-
</table>
|
1394
|
-
</div>
|
1395
|
-
|
1396
|
-
<div class="method_details ">
|
1397
|
-
<h3 class="signature " id="new_row-instance_method">
|
1398
|
-
|
1399
|
-
- (<tt>Object</tt>) <strong>new_row</strong>(cell_values = [])
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
</h3><div class="docstring">
|
1406
|
-
<div class="discussion">
|
1407
|
-
|
1408
|
-
<p>Generates a new row, with optionally predefined cell-values, that is
|
1409
|
-
already connected to this table.</p>
|
1410
|
-
|
1411
|
-
|
1412
|
-
</div>
|
1413
|
-
</div>
|
1414
|
-
<div class="tags">
|
1415
|
-
|
1416
|
-
|
1417
|
-
</div><table class="source_code">
|
1418
|
-
<tr>
|
1419
|
-
<td>
|
1420
|
-
<pre class="lines">
|
1421
|
-
|
1422
|
-
|
1423
|
-
43
|
1424
|
-
44
|
1425
|
-
45
|
1426
|
-
46</pre>
|
1427
|
-
</td>
|
1428
|
-
<td>
|
1429
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 43</span>
|
1430
|
-
|
1431
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_new_row'>new_row</span> <span class='id identifier rubyid_cell_values'>cell_values</span><span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1432
|
-
<span class='id identifier rubyid_r'>r</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Row</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_cell_values'>cell_values</span><span class='comma'>,</span><span class='kw'>self</span><span class='rparen'>)</span>
|
1433
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_r'>r</span>
|
1434
|
-
<span class='kw'>end</span></pre>
|
1435
|
-
</td>
|
1436
|
-
</tr>
|
1437
|
-
</table>
|
1438
|
-
</div>
|
1439
|
-
|
1440
|
-
<div class="method_details ">
|
1441
|
-
<h3 class="signature " id="push-instance_method">
|
1442
|
-
|
1443
|
-
- (<tt>Object</tt>) <strong>push</strong>(row)
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
</h3><div class="docstring">
|
1450
|
-
<div class="discussion">
|
1451
|
-
|
1452
|
-
<p>Add row</p>
|
1453
|
-
|
1454
|
-
|
1455
|
-
</div>
|
1456
|
-
</div>
|
1457
|
-
<div class="tags">
|
1458
|
-
<p class="tag_title">Parameters:</p>
|
1459
|
-
<ul class="param">
|
1460
|
-
|
1461
|
-
<li>
|
1462
|
-
|
1463
|
-
<span class='name'>row</span>
|
1464
|
-
|
1465
|
-
|
1466
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Table (class)">Workbook::Table</a></span></tt>, <tt>Array</tt>)</span>
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
—
|
1471
|
-
<div class='inline'>
|
1472
|
-
<p>to add</p>
|
1473
|
-
</div>
|
1474
|
-
|
1475
|
-
</li>
|
1476
|
-
|
1477
|
-
</ul>
|
1478
|
-
|
1479
|
-
|
1480
|
-
</div><table class="source_code">
|
1481
|
-
<tr>
|
1482
|
-
<td>
|
1483
|
-
<pre class="lines">
|
1484
|
-
|
1485
|
-
|
1486
|
-
64
|
1487
|
-
65
|
1488
|
-
66
|
1489
|
-
67
|
1490
|
-
68</pre>
|
1491
|
-
</td>
|
1492
|
-
<td>
|
1493
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 64</span>
|
1494
|
-
|
1495
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
1496
|
-
<span class='id identifier rubyid_row'>row</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Row</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Array</span>
|
1497
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
1498
|
-
<span class='id identifier rubyid_row'>row</span><span class='period'>.</span><span class='id identifier rubyid_set_table'>set_table</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
|
1499
|
-
<span class='kw'>end</span></pre>
|
1500
|
-
</td>
|
1501
|
-
</tr>
|
1502
|
-
</table>
|
1503
|
-
</div>
|
1504
|
-
|
1505
|
-
<div class="method_details ">
|
1506
|
-
<h3 class="signature " id="remove_empty_lines!-instance_method">
|
1507
|
-
|
1508
|
-
- (<tt>Object</tt>) <strong>remove_empty_lines!</strong>
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
</h3><table class="source_code">
|
1515
|
-
<tr>
|
1516
|
-
<td>
|
1517
|
-
<pre class="lines">
|
1518
|
-
|
1519
|
-
|
1520
|
-
57
|
1521
|
-
58
|
1522
|
-
59
|
1523
|
-
60</pre>
|
1524
|
-
</td>
|
1525
|
-
<td>
|
1526
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 57</span>
|
1527
|
-
|
1528
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_remove_empty_lines!'>remove_empty_lines!</span>
|
1529
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_r'>r</span><span class='op'>|</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>or</span> <span class='id identifier rubyid_r'>r</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='rbrace'>}</span>
|
1530
|
-
<span class='kw'>self</span>
|
1531
|
-
<span class='kw'>end</span></pre>
|
1532
|
-
</td>
|
1533
|
-
</tr>
|
1534
|
-
</table>
|
1535
|
-
</div>
|
1536
|
-
|
1537
|
-
<div class="method_details ">
|
1538
|
-
<h3 class="signature " id="trim-instance_method">
|
1539
|
-
|
1540
|
-
- (<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>) <strong>trim</strong>(desired_row_length = nil)
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1545
|
-
|
1546
|
-
</h3><div class="docstring">
|
1547
|
-
<div class="discussion">
|
1548
|
-
|
1549
|
-
<p>remove all the trailing empty-rows (returning a trimmed clone)</p>
|
1550
|
-
|
1551
|
-
|
1552
|
-
</div>
|
1553
|
-
</div>
|
1554
|
-
<div class="tags">
|
1555
|
-
<p class="tag_title">Parameters:</p>
|
1556
|
-
<ul class="param">
|
1557
|
-
|
1558
|
-
<li>
|
1559
|
-
|
1560
|
-
<span class='name'>desired_row_length</span>
|
1561
|
-
|
1562
|
-
|
1563
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
1564
|
-
|
1565
|
-
|
1566
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1567
|
-
|
1568
|
-
|
1569
|
-
—
|
1570
|
-
<div class='inline'>
|
1571
|
-
<p>of the rows</p>
|
1572
|
-
</div>
|
1573
|
-
|
1574
|
-
</li>
|
1575
|
-
|
1576
|
-
</ul>
|
1577
|
-
|
1578
|
-
<p class="tag_title">Returns:</p>
|
1579
|
-
<ul class="return">
|
1580
|
-
|
1581
|
-
<li>
|
1582
|
-
|
1583
|
-
|
1584
|
-
<span class='type'>(<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>)</span>
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
—
|
1589
|
-
<div class='inline'>
|
1590
|
-
<p>a trimmed clone of the array</p>
|
1591
|
-
</div>
|
1592
|
-
|
1593
|
-
</li>
|
1594
|
-
|
1595
|
-
</ul>
|
1596
|
-
|
1597
|
-
</div><table class="source_code">
|
1598
|
-
<tr>
|
1599
|
-
<td>
|
1600
|
-
<pre class="lines">
|
1601
|
-
|
1602
|
-
|
1603
|
-
160
|
1604
|
-
161
|
1605
|
-
162</pre>
|
1606
|
-
</td>
|
1607
|
-
<td>
|
1608
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 160</span>
|
1609
|
-
|
1610
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_trim'>trim</span><span class='lparen'>(</span><span class='id identifier rubyid_desired_row_length'>desired_row_length</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
1611
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_clone'>clone</span><span class='period'>.</span><span class='id identifier rubyid_trim!'>trim!</span><span class='lparen'>(</span><span class='id identifier rubyid_desired_row_length'>desired_row_length</span><span class='rparen'>)</span>
|
1612
|
-
<span class='kw'>end</span></pre>
|
1613
|
-
</td>
|
1614
|
-
</tr>
|
1615
|
-
</table>
|
1616
|
-
</div>
|
1617
|
-
|
1618
|
-
<div class="method_details ">
|
1619
|
-
<h3 class="signature " id="trim!-instance_method">
|
1620
|
-
|
1621
|
-
- (<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>) <strong>trim!</strong>(desired_row_length = nil)
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
</h3><div class="docstring">
|
1628
|
-
<div class="discussion">
|
1629
|
-
|
1630
|
-
<p>remove all the trailing empty-rows (returning a trimmed self)</p>
|
1631
|
-
|
1632
|
-
|
1633
|
-
</div>
|
1634
|
-
</div>
|
1635
|
-
<div class="tags">
|
1636
|
-
<p class="tag_title">Parameters:</p>
|
1637
|
-
<ul class="param">
|
1638
|
-
|
1639
|
-
<li>
|
1640
|
-
|
1641
|
-
<span class='name'>desired_row_length</span>
|
1642
|
-
|
1643
|
-
|
1644
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
1645
|
-
|
1646
|
-
|
1647
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1648
|
-
|
1649
|
-
|
1650
|
-
—
|
1651
|
-
<div class='inline'>
|
1652
|
-
<p>of the new row</p>
|
1653
|
-
</div>
|
1654
|
-
|
1655
|
-
</li>
|
1656
|
-
|
1657
|
-
</ul>
|
1658
|
-
|
1659
|
-
<p class="tag_title">Returns:</p>
|
1660
|
-
<ul class="return">
|
1661
|
-
|
1662
|
-
<li>
|
1663
|
-
|
1664
|
-
|
1665
|
-
<span class='type'>(<tt><span class='object_link'><a href="Row.html" title="Workbook::Row (class)">Workbook::Row</a></span></tt>)</span>
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
—
|
1670
|
-
<div class='inline'>
|
1671
|
-
<p>self</p>
|
1672
|
-
</div>
|
1673
|
-
|
1674
|
-
</li>
|
1675
|
-
|
1676
|
-
</ul>
|
1677
|
-
|
1678
|
-
</div><table class="source_code">
|
1679
|
-
<tr>
|
1680
|
-
<td>
|
1681
|
-
<pre class="lines">
|
1682
|
-
|
1683
|
-
|
1684
|
-
168
|
1685
|
-
169
|
1686
|
-
170
|
1687
|
-
171
|
1688
|
-
172
|
1689
|
-
173
|
1690
|
-
174
|
1691
|
-
175
|
1692
|
-
176
|
1693
|
-
177
|
1694
|
-
178
|
1695
|
-
179
|
1696
|
-
180
|
1697
|
-
181</pre>
|
1698
|
-
</td>
|
1699
|
-
<td>
|
1700
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 168</span>
|
1701
|
-
|
1702
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_trim!'>trim!</span><span class='lparen'>(</span><span class='id identifier rubyid_desired_row_length'>desired_row_length</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
1703
|
-
<span class='id identifier rubyid_max_length'>max_length</span> <span class='op'>=</span> <span class='kw'>self</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_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_trim'>trim</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span>
|
1704
|
-
<span class='id identifier rubyid_self_count'>self_count</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='op'>-</span><span class='int'>1</span>
|
1705
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_index'>index</span><span class='op'>|</span>
|
1706
|
-
<span class='id identifier rubyid_index'>index</span> <span class='op'>=</span> <span class='id identifier rubyid_self_count'>self_count</span> <span class='op'>-</span> <span class='id identifier rubyid_index'>index</span>
|
1707
|
-
<span class='kw'>if</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_trim'>trim</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1708
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete_at'>delete_at</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
1709
|
-
<span class='kw'>else</span>
|
1710
|
-
<span class='kw'>break</span>
|
1711
|
-
<span class='kw'>end</span>
|
1712
|
-
<span class='kw'>end</span>
|
1713
|
-
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span> <span class='id identifier rubyid_a'>a</span><span class='period'>.</span><span class='id identifier rubyid_trim!'>trim!</span><span class='lparen'>(</span><span class='id identifier rubyid_max_length'>max_length</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
1714
|
-
<span class='kw'>self</span>
|
1715
|
-
<span class='kw'>end</span></pre>
|
1716
|
-
</td>
|
1717
|
-
</tr>
|
1718
|
-
</table>
|
1719
|
-
</div>
|
1720
|
-
|
1721
|
-
</div>
|
1722
|
-
|
1723
|
-
</div>
|
1724
|
-
|
1725
|
-
<div id="footer">
|
1726
|
-
Generated on Sun May 19 23:16:31 2013 by
|
1727
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1728
|
-
0.8.5.2 (ruby-1.9.3).
|
1729
|
-
</div>
|
1730
|
-
|
1731
|
-
</body>
|
1732
|
-
</html>
|