workbook 0.4.2 → 0.4.3
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.
- data/.gitignore +2 -1
- data/.yardoc/checksums +22 -21
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/Gemfile.lock +2 -2
- data/doc/RubyXL.html +1 -1
- data/doc/RubyXL/Cell.html +1 -1
- data/doc/RubyXL/Workbook.html +31 -31
- data/doc/Workbook.html +4 -4
- data/doc/Workbook/Book.html +5 -5
- data/doc/Workbook/Cell.html +202 -62
- data/doc/Workbook/Format.html +32 -32
- data/doc/Workbook/Modules.html +1 -1
- data/doc/Workbook/Modules/RawObjectsStorage.html +5 -5
- data/doc/Workbook/Modules/TableDiffSort.html +14 -14
- data/doc/Workbook/Modules/TypeParser.html +7 -7
- data/doc/Workbook/NilValue.html +434 -0
- data/doc/Workbook/Readers.html +3 -3
- data/doc/Workbook/Readers/CsvReader.html +6 -6
- data/doc/Workbook/Readers/OdsReader.html +562 -60
- data/doc/Workbook/Readers/TxtReader.html +2 -2
- data/doc/Workbook/Readers/XlsReader.html +14 -14
- data/doc/Workbook/Readers/XlsShared.html +67 -67
- data/doc/Workbook/Readers/XlsxReader.html +7 -7
- data/doc/Workbook/Row.html +243 -5
- data/doc/Workbook/Sheet.html +2 -2
- data/doc/Workbook/Table.html +669 -58
- data/doc/Workbook/Template.html +5 -5
- data/doc/Workbook/Writers.html +1 -1
- data/doc/Workbook/Writers/CsvTableWriter.html +1 -1
- data/doc/Workbook/Writers/HtmlWriter.html +27 -13
- data/doc/Workbook/Writers/XlsWriter.html +2 -2
- data/doc/_index.html +23 -8
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +16 -12
- data/doc/index.html +16 -12
- data/doc/method_list.html +232 -72
- data/doc/top-level-namespace.html +1 -1
- data/lib/workbook/book.rb +25 -25
- data/lib/workbook/cell.rb +33 -33
- data/lib/workbook/format.rb +10 -10
- data/lib/workbook/modules/raw_objects_storage.rb +19 -19
- data/lib/workbook/modules/table_diff_sort.rb +22 -22
- data/lib/workbook/modules/type_parser.rb +18 -18
- data/lib/workbook/nil_value.rb +6 -6
- data/lib/workbook/readers/csv_reader.rb +8 -8
- data/lib/workbook/readers/ods_reader.rb +92 -46
- data/lib/workbook/readers/txt_reader.rb +2 -2
- data/lib/workbook/readers/xls_reader.rb +19 -19
- data/lib/workbook/readers/xls_shared.rb +70 -70
- data/lib/workbook/readers/xlsx_reader.rb +42 -42
- data/lib/workbook/row.rb +59 -29
- data/lib/workbook/sheet.rb +8 -8
- data/lib/workbook/table.rb +52 -19
- data/lib/workbook/template.rb +10 -10
- data/lib/workbook/version.rb +1 -1
- data/lib/workbook/writers/csv_table_writer.rb +1 -1
- data/lib/workbook/writers/html_writer.rb +6 -6
- data/lib/workbook/writers/xls_writer.rb +12 -12
- data/rbeautify.rb +232 -0
- data/test/artifacts/book_with_colspans.ods +0 -0
- data/test/artifacts/book_with_tabs_and_colours.ods +0 -0
- data/test/test_book.rb +10 -10
- data/test/test_cell.rb +14 -14
- data/test/test_format.rb +11 -11
- data/test/test_functional.rb +3 -3
- data/test/test_modules_table_diff_sort.rb +24 -24
- data/test/test_modules_type_parser.rb +27 -27
- data/test/test_readers_csv_reader.rb +11 -11
- data/test/test_readers_ods_reader.rb +22 -15
- data/test/test_readers_txt_reader.rb +13 -13
- data/test/test_readers_xls_reader.rb +11 -11
- data/test/test_readers_xlsx_reader.rb +5 -5
- data/test/test_row.rb +96 -26
- data/test/test_sheet.rb +9 -9
- data/test/test_table.rb +42 -26
- data/test/test_template.rb +3 -3
- data/test/test_writers_html_writer.rb +6 -4
- data/test/test_writers_xls_writer.rb +7 -7
- metadata +5 -1
data/doc/Workbook/Sheet.html
CHANGED
@@ -682,7 +682,7 @@
|
|
682
682
|
<span class='id identifier rubyid_t'>t</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>
|
683
683
|
<span class='id identifier rubyid_t'>t</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> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Table</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_t'>t</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
684
684
|
<span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_sheet'>sheet</span> <span class='op'>=</span> <span class='kw'>self</span>
|
685
|
-
<span class='id identifier rubyid_t'>t</span>
|
685
|
+
<span class='id identifier rubyid_t'>t</span>
|
686
686
|
<span class='kw'>end</span></pre>
|
687
687
|
</td>
|
688
688
|
</tr>
|
@@ -866,7 +866,7 @@
|
|
866
866
|
</div>
|
867
867
|
|
868
868
|
<div id="footer">
|
869
|
-
Generated on Sun May
|
869
|
+
Generated on Sun May 19 23:16:31 2013 by
|
870
870
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
871
871
|
0.8.5.2 (ruby-1.9.3).
|
872
872
|
</div>
|
data/doc/Workbook/Table.html
CHANGED
@@ -150,6 +150,33 @@ diffing with another table is included.</p>
|
|
150
150
|
different row).</p>
|
151
151
|
</div></span>
|
152
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
|
+
|
153
180
|
</li>
|
154
181
|
|
155
182
|
|
@@ -211,7 +238,58 @@ exists.</p>
|
|
211
238
|
|
212
239
|
|
213
240
|
|
214
|
-
<span class="summary_desc"><div class='inline'
|
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>
|
215
293
|
|
216
294
|
</li>
|
217
295
|
|
@@ -400,7 +478,9 @@ already connected to this table.</p>
|
|
400
478
|
|
401
479
|
|
402
480
|
|
403
|
-
<span class="summary_desc"><div class='inline'
|
481
|
+
<span class="summary_desc"><div class='inline'>
|
482
|
+
<p>Add row.</p>
|
483
|
+
</div></span>
|
404
484
|
|
405
485
|
</li>
|
406
486
|
|
@@ -424,6 +504,54 @@ already connected to this table.</p>
|
|
424
504
|
|
425
505
|
<span class="summary_desc"><div class='inline'></div></span>
|
426
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
|
+
|
427
555
|
</li>
|
428
556
|
|
429
557
|
|
@@ -482,7 +610,6 @@ already connected to this table.</p>
|
|
482
610
|
<pre class="lines">
|
483
611
|
|
484
612
|
|
485
|
-
14
|
486
613
|
15
|
487
614
|
16
|
488
615
|
17
|
@@ -493,10 +620,11 @@ already connected to this table.</p>
|
|
493
620
|
22
|
494
621
|
23
|
495
622
|
24
|
496
|
-
25
|
623
|
+
25
|
624
|
+
26</pre>
|
497
625
|
</td>
|
498
626
|
<td>
|
499
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
627
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 15</span>
|
500
628
|
|
501
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>
|
502
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>
|
@@ -535,7 +663,7 @@ already connected to this table.</p>
|
|
535
663
|
<div class="discussion">
|
536
664
|
|
537
665
|
<p>Returns the header of this table (typically the first row, but can be a
|
538
|
-
different row).
|
666
|
+
different row). The header row is also used for finding values in a
|
539
667
|
aribrary row.</p>
|
540
668
|
|
541
669
|
|
@@ -568,12 +696,12 @@ aribrary row.</p>
|
|
568
696
|
<pre class="lines">
|
569
697
|
|
570
698
|
|
571
|
-
31
|
572
699
|
32
|
573
|
-
33
|
700
|
+
33
|
701
|
+
34</pre>
|
574
702
|
</td>
|
575
703
|
<td>
|
576
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
704
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 32</span>
|
577
705
|
|
578
706
|
<span class='kw'>def</span> <span class='id identifier rubyid_header'>header</span>
|
579
707
|
<span class='ivar'>@header</span>
|
@@ -584,6 +712,49 @@ aribrary row.</p>
|
|
584
712
|
</div>
|
585
713
|
|
586
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
|
+
|
587
758
|
<span id="sheet=-instance_method"></span>
|
588
759
|
<div class="method_details ">
|
589
760
|
<h3 class="signature " id="sheet-instance_method">
|
@@ -629,12 +800,12 @@ aribrary row.</p>
|
|
629
800
|
<pre class="lines">
|
630
801
|
|
631
802
|
|
632
|
-
|
633
|
-
|
634
|
-
|
803
|
+
94
|
804
|
+
95
|
805
|
+
96</pre>
|
635
806
|
</td>
|
636
807
|
<td>
|
637
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
808
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 94</span>
|
638
809
|
|
639
810
|
<span class='kw'>def</span> <span class='id identifier rubyid_sheet'>sheet</span>
|
640
811
|
<span class='ivar'>@sheet</span>
|
@@ -660,27 +831,250 @@ aribrary row.</p>
|
|
660
831
|
|
661
832
|
|
662
833
|
|
663
|
-
</h3><
|
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">
|
664
866
|
<tr>
|
665
867
|
<td>
|
666
868
|
<pre class="lines">
|
667
869
|
|
668
870
|
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
871
|
+
72
|
872
|
+
73
|
873
|
+
74
|
874
|
+
75
|
875
|
+
76</pre>
|
673
876
|
</td>
|
674
877
|
<td>
|
675
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
878
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 72</span>
|
676
879
|
|
677
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>
|
678
882
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
679
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>
|
680
884
|
<span class='kw'>end</span></pre>
|
681
885
|
</td>
|
682
886
|
</tr>
|
683
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>
|
684
1078
|
</div>
|
685
1079
|
|
686
1080
|
<div class="method_details ">
|
@@ -727,18 +1121,18 @@ aribrary row.</p>
|
|
727
1121
|
<pre class="lines">
|
728
1122
|
|
729
1123
|
|
730
|
-
106
|
731
|
-
107
|
732
|
-
108
|
733
|
-
109
|
734
|
-
110
|
735
|
-
111
|
736
|
-
112
|
737
1124
|
113
|
738
|
-
114
|
1125
|
+
114
|
1126
|
+
115
|
1127
|
+
116
|
1128
|
+
117
|
1129
|
+
118
|
1130
|
+
119
|
1131
|
+
120
|
1132
|
+
121</pre>
|
739
1133
|
</td>
|
740
1134
|
<td>
|
741
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1135
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 113</span>
|
742
1136
|
|
743
1137
|
<span class='kw'>def</span> <span class='id identifier rubyid_clone'>clone</span>
|
744
1138
|
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='kw'>self</span>
|
@@ -831,13 +1225,13 @@ aribrary row.</p>
|
|
831
1225
|
<pre class="lines">
|
832
1226
|
|
833
1227
|
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
1228
|
+
86
|
1229
|
+
87
|
1230
|
+
88
|
1231
|
+
89</pre>
|
838
1232
|
</td>
|
839
1233
|
<td>
|
840
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1234
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 86</span>
|
841
1235
|
|
842
1236
|
<span class='kw'>def</span> <span class='id identifier rubyid_contains_row?'>contains_row?</span> <span class='id identifier rubyid_row'>row</span>
|
843
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>
|
@@ -863,17 +1257,17 @@ aribrary row.</p>
|
|
863
1257
|
<pre class="lines">
|
864
1258
|
|
865
1259
|
|
866
|
-
47
|
867
1260
|
48
|
868
1261
|
49
|
869
1262
|
50
|
870
1263
|
51
|
871
1264
|
52
|
872
1265
|
53
|
873
|
-
54
|
1266
|
+
54
|
1267
|
+
55</pre>
|
874
1268
|
</td>
|
875
1269
|
<td>
|
876
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1270
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 48</span>
|
877
1271
|
|
878
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>
|
879
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>
|
@@ -881,7 +1275,7 @@ aribrary row.</p>
|
|
881
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>
|
882
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>
|
883
1277
|
<span class='kw'>end</span>
|
884
|
-
<span class='id identifier rubyid_r'>r</span>
|
1278
|
+
<span class='id identifier rubyid_r'>r</span>
|
885
1279
|
<span class='kw'>end</span></pre>
|
886
1280
|
</td>
|
887
1281
|
</tr>
|
@@ -932,12 +1326,12 @@ aribrary row.</p>
|
|
932
1326
|
<pre class="lines">
|
933
1327
|
|
934
1328
|
|
935
|
-
|
936
|
-
|
937
|
-
|
1329
|
+
106
|
1330
|
+
107
|
1331
|
+
108</pre>
|
938
1332
|
</td>
|
939
1333
|
<td>
|
940
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1334
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 106</span>
|
941
1335
|
|
942
1336
|
<span class='kw'>def</span> <span class='id identifier rubyid_delete_all'>delete_all</span>
|
943
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>
|
@@ -984,12 +1378,12 @@ aribrary row.</p>
|
|
984
1378
|
<pre class="lines">
|
985
1379
|
|
986
1380
|
|
987
|
-
|
988
|
-
|
989
|
-
|
1381
|
+
78
|
1382
|
+
79
|
1383
|
+
80</pre>
|
990
1384
|
</td>
|
991
1385
|
<td>
|
992
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1386
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 78</span>
|
993
1387
|
|
994
1388
|
<span class='kw'>def</span> <span class='id identifier rubyid_has_contents?'>has_contents?</span>
|
995
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>
|
@@ -1026,13 +1420,13 @@ already connected to this table.</p>
|
|
1026
1420
|
<pre class="lines">
|
1027
1421
|
|
1028
1422
|
|
1029
|
-
42
|
1030
1423
|
43
|
1031
1424
|
44
|
1032
|
-
45
|
1425
|
+
45
|
1426
|
+
46</pre>
|
1033
1427
|
</td>
|
1034
1428
|
<td>
|
1035
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1429
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 43</span>
|
1036
1430
|
|
1037
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>
|
1038
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>
|
@@ -1052,21 +1446,54 @@ already connected to this table.</p>
|
|
1052
1446
|
|
1053
1447
|
|
1054
1448
|
|
1055
|
-
</h3><
|
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">
|
1056
1481
|
<tr>
|
1057
1482
|
<td>
|
1058
1483
|
<pre class="lines">
|
1059
1484
|
|
1060
1485
|
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1486
|
+
64
|
1487
|
+
65
|
1488
|
+
66
|
1489
|
+
67
|
1490
|
+
68</pre>
|
1065
1491
|
</td>
|
1066
1492
|
<td>
|
1067
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1493
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 64</span>
|
1068
1494
|
|
1069
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>
|
1070
1497
|
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_row'>row</span><span class='rparen'>)</span>
|
1071
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>
|
1072
1499
|
<span class='kw'>end</span></pre>
|
@@ -1090,13 +1517,13 @@ already connected to this table.</p>
|
|
1090
1517
|
<pre class="lines">
|
1091
1518
|
|
1092
1519
|
|
1093
|
-
56
|
1094
1520
|
57
|
1095
1521
|
58
|
1096
|
-
59
|
1522
|
+
59
|
1523
|
+
60</pre>
|
1097
1524
|
</td>
|
1098
1525
|
<td>
|
1099
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line
|
1526
|
+
<pre class="code"><span class="info file"># File 'lib/workbook/table.rb', line 57</span>
|
1100
1527
|
|
1101
1528
|
<span class='kw'>def</span> <span class='id identifier rubyid_remove_empty_lines!'>remove_empty_lines!</span>
|
1102
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>
|
@@ -1105,6 +1532,190 @@ already connected to this table.</p>
|
|
1105
1532
|
</td>
|
1106
1533
|
</tr>
|
1107
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>
|
1108
1719
|
</div>
|
1109
1720
|
|
1110
1721
|
</div>
|
@@ -1112,7 +1723,7 @@ already connected to this table.</p>
|
|
1112
1723
|
</div>
|
1113
1724
|
|
1114
1725
|
<div id="footer">
|
1115
|
-
Generated on Sun May
|
1726
|
+
Generated on Sun May 19 23:16:31 2013 by
|
1116
1727
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1117
1728
|
0.8.5.2 (ruby-1.9.3).
|
1118
1729
|
</div>
|