table_fu 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.gitignore +4 -0
  2. data/LICENSE +20 -0
  3. data/README +37 -0
  4. data/Rakefile +58 -0
  5. data/VERSION.yml +5 -0
  6. data/doc/TableFu/Datum.html +743 -0
  7. data/doc/TableFu/Formatting.html +469 -0
  8. data/doc/TableFu/Header.html +198 -0
  9. data/doc/TableFu/Row.html +508 -0
  10. data/doc/TableFu.html +1806 -0
  11. data/doc/_index.html +154 -0
  12. data/doc/class_list.html +36 -0
  13. data/doc/css/common.css +1 -0
  14. data/doc/css/full_list.css +50 -0
  15. data/doc/css/style.css +268 -0
  16. data/doc/file.README.html +89 -0
  17. data/doc/file_list.html +38 -0
  18. data/doc/frames.html +13 -0
  19. data/doc/index.html +89 -0
  20. data/doc/js/app.js +99 -0
  21. data/doc/js/full_list.js +106 -0
  22. data/doc/js/jquery.js +19 -0
  23. data/doc/method_list.html +363 -0
  24. data/doc/top-level-namespace.html +85 -0
  25. data/documentation/css/dawn.css +121 -0
  26. data/documentation/css/styles.css +63 -0
  27. data/documentation/images/proplogo.png +0 -0
  28. data/documentation/index.html.erb +148 -0
  29. data/examples/columns.rb +7 -0
  30. data/examples/columns_hidden.rb +5 -0
  31. data/examples/faceting.rb +2 -0
  32. data/examples/formatting_options.rb +6 -0
  33. data/examples/last_name.rb +4 -0
  34. data/examples/link.rb +11 -0
  35. data/examples/only.rb +6 -0
  36. data/examples/rails_helpers.rb +3 -0
  37. data/examples/sort_by_column.rb +11 -0
  38. data/examples/sort_by_number.rb +0 -0
  39. data/examples/totals.rb +2 -0
  40. data/examples/zap_joyce.rb +3 -0
  41. data/index.html +210 -0
  42. data/lib/table_fu/formatting.rb +52 -0
  43. data/lib/table_fu.rb +386 -0
  44. data/spec/assets/sample.csv +476 -0
  45. data/spec/assets/test.csv +8 -0
  46. data/spec/assets/test_macro.csv +8 -0
  47. data/spec/rcov.opts +2 -0
  48. data/spec/readme_example_spec.rb +39 -0
  49. data/spec/spec.opts +4 -0
  50. data/spec/spec_helper.rb +4 -0
  51. data/spec/table_fu_spec.rb +221 -0
  52. data/table_fu.gemspec +112 -0
  53. metadata +141 -0
data/doc/TableFu.html ADDED
@@ -0,0 +1,1806 @@
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 name="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>Class: TableFu</title>
7
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
8
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
9
+
10
+ <script type="text/javascript" charset="utf-8">
11
+ relpath = '';
12
+ if (relpath != '') relpath += '/';
13
+ </script>
14
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
15
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
16
+
17
+ </head>
18
+ <body>
19
+ <script type="text/javascript" charset="utf-8">
20
+ if (window.top.frames.main) document.body.className = 'frames';
21
+ </script>
22
+
23
+ <div id="header">
24
+ <div id="menu">
25
+
26
+ <a href="_index.html">Index (T)</a> &raquo;
27
+
28
+
29
+ <span class="title">TableFu</span>
30
+
31
+
32
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
33
+ </div>
34
+
35
+ <div id="search">
36
+ <a id="class_list_link" href="#">Class List</a>
37
+ <a id="method_list_link" href="#">Method List</a>
38
+ <a id ="file_list_link" href="#">File List</a>
39
+ </div>
40
+
41
+ <div class="clear"></div>
42
+ </div>
43
+
44
+ <iframe id="search_frame"></iframe>
45
+
46
+ <div id="content"><h1>Class: TableFu
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">Object</span>
56
+
57
+ <ul class="fullTree">
58
+ <li>Object</li>
59
+
60
+ <li class="next">TableFu</li>
61
+
62
+ </ul>
63
+ <a href="#" class="inheritanceTree">show all</a>
64
+
65
+ </dd>
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r2 last">Defined in:</dt>
75
+ <dd class="r2 last">lib/table_fu.rb<span class="defines">,<br />
76
+ lib/table_fu.rb</span>
77
+ </dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+ <h2>Overview</h2><div class="docstring">
83
+ <div class="discussion">
84
+ <p>
85
+ TableFu turns a matric array(from a csv file for example) into a
86
+ spreadsheet.
87
+ </p>
88
+ <p>
89
+ Allows formatting, macros, sorting, and faceting.
90
+ </p>
91
+ <p>
92
+ Documentation: http://propublica.github.com/table-fu
93
+ </p>
94
+
95
+
96
+ </div>
97
+ </div>
98
+ <div class="tags">
99
+
100
+ </div>
101
+
102
+ <h2>Instance Attribute Summary</h2>
103
+ <ul class="summary">
104
+
105
+ <li class="public ">
106
+ <span class="summary_signature">
107
+
108
+ <a href="#col_opts-instance_method" title="#col_opts (instance method)">- (Object) <strong>col_opts</strong> </a>
109
+
110
+
111
+
112
+ </span>
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <span class="summary_desc">
124
+ Returns the value of attribute col_opts.
125
+
126
+ </span>
127
+
128
+ </li>
129
+
130
+
131
+ <li class="public ">
132
+ <span class="summary_signature">
133
+
134
+ <a href="#column_headers-instance_method" title="#column_headers (instance method)">- (Object) <strong>column_headers</strong> </a>
135
+
136
+
137
+
138
+ </span>
139
+
140
+
141
+ <span class="note title readonly">readonly</span>
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <span class="summary_desc">
150
+ Returns the value of attribute column_headers.
151
+
152
+ </span>
153
+
154
+ </li>
155
+
156
+
157
+ <li class="public ">
158
+ <span class="summary_signature">
159
+
160
+ <a href="#deleted_rows-instance_method" title="#deleted_rows (instance method)">- (Object) <strong>deleted_rows</strong> </a>
161
+
162
+
163
+
164
+ </span>
165
+
166
+
167
+ <span class="note title readonly">readonly</span>
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+ <span class="summary_desc">
176
+ Returns the value of attribute deleted_rows.
177
+
178
+ </span>
179
+
180
+ </li>
181
+
182
+
183
+ <li class="public ">
184
+ <span class="summary_signature">
185
+
186
+ <a href="#faceted_on-instance_method" title="#faceted_on (instance method)">- (Object) <strong>faceted_on</strong> </a>
187
+
188
+
189
+
190
+ </span>
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+ <span class="summary_desc">
202
+ Returns the value of attribute faceted_on.
203
+
204
+ </span>
205
+
206
+ </li>
207
+
208
+
209
+ <li class="public ">
210
+ <span class="summary_signature">
211
+
212
+ <a href="#table-instance_method" title="#table (instance method)">- (Object) <strong>table</strong> </a>
213
+
214
+
215
+
216
+ </span>
217
+
218
+
219
+ <span class="note title readonly">readonly</span>
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+ <span class="summary_desc">
228
+ Returns the value of attribute table.
229
+
230
+ </span>
231
+
232
+ </li>
233
+
234
+
235
+ <li class="public ">
236
+ <span class="summary_signature">
237
+
238
+ <a href="#totals-instance_method" title="#totals (instance method)">- (Object) <strong>totals</strong> </a>
239
+
240
+
241
+
242
+ </span>
243
+
244
+
245
+ <span class="note title readonly">readonly</span>
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+ <span class="summary_desc">
254
+ Returns the value of attribute totals.
255
+
256
+ </span>
257
+
258
+ </li>
259
+
260
+
261
+ </ul>
262
+
263
+
264
+ <h2>Instance Method Summary</h2>
265
+
266
+ <ul class="summary">
267
+
268
+ <li class="public ">
269
+ <span class="summary_signature">
270
+
271
+ <a href="#columns-instance_method" title="#columns (instance method)">- (Object) <strong>columns</strong> </a>
272
+
273
+
274
+
275
+ </span>
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+ <span class="summary_desc">
284
+ Return the headers defined in column headers or cherry picked from
285
+ @col_opts.
286
+
287
+ </span>
288
+
289
+ </li>
290
+
291
+
292
+ <li class="public ">
293
+ <span class="summary_signature">
294
+
295
+ <a href="#columns%3D-instance_method" title="#columns= (instance method)">- (Object) <strong>columns</strong>(array) </a>
296
+
297
+
298
+
299
+ </span>
300
+
301
+
302
+
303
+
304
+
305
+
306
+
307
+ <span class="summary_desc">
308
+ Set up the cherry picked columns.
309
+
310
+ </span>
311
+
312
+ </li>
313
+
314
+
315
+ <li class="public ">
316
+ <span class="summary_signature">
317
+
318
+ <a href="#delete_rows%21-instance_method" title="#delete_rows! (instance method)">- (Object) <strong>delete_rows!</strong>(arr) </a>
319
+
320
+
321
+
322
+ </span>
323
+
324
+
325
+
326
+
327
+
328
+
329
+
330
+ <span class="summary_desc">
331
+ Pass it an array and it will delete it from the table, but save the data in
332
+ @deleted_rows@ for later perusal.
333
+
334
+ </span>
335
+
336
+ </li>
337
+
338
+
339
+ <li class="public ">
340
+ <span class="summary_signature">
341
+
342
+ <a href="#faceted%3F-instance_method" title="#faceted? (instance method)">- (Boolean) <strong>faceted?</strong> </a>
343
+
344
+
345
+
346
+ </span>
347
+
348
+
349
+
350
+
351
+
352
+
353
+
354
+ <span class="summary_desc">
355
+ Return true if this table is faceted.
356
+
357
+ </span>
358
+
359
+ </li>
360
+
361
+
362
+ <li class="public ">
363
+ <span class="summary_signature">
364
+
365
+ <a href="#faceted_by-instance_method" title="#faceted_by (instance method)">- (Object) <strong>faceted_by</strong>(column, opts = {}) </a>
366
+
367
+
368
+
369
+ </span>
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+ <span class="summary_desc">
378
+ Return an array of TableFu instances grouped by a column.
379
+
380
+ </span>
381
+
382
+ </li>
383
+
384
+
385
+ <li class="public ">
386
+ <span class="summary_signature">
387
+
388
+ <a href="#formatting-instance_method" title="#formatting (instance method)">- (Object) <strong>formatting</strong> </a>
389
+
390
+
391
+
392
+ </span>
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+ <span class="summary_desc">
401
+ Return the formatting hash.
402
+
403
+ </span>
404
+
405
+ </li>
406
+
407
+
408
+ <li class="public ">
409
+ <span class="summary_signature">
410
+
411
+ <a href="#formatting%3D-instance_method" title="#formatting= (instance method)">- (Object) <strong>formatting</strong>(headers) </a>
412
+
413
+
414
+
415
+ </span>
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+ <span class="summary_desc">
424
+ Set the formatting hash.
425
+
426
+ </span>
427
+
428
+ </li>
429
+
430
+
431
+ <li class="public ">
432
+ <span class="summary_signature">
433
+
434
+ <a href="#headers-instance_method" title="#headers (instance method)">- (Object) <strong>headers</strong> </a>
435
+
436
+
437
+
438
+ </span>
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+ <span class="summary_desc">
447
+ Return the headers of the array.
448
+
449
+ </span>
450
+
451
+ </li>
452
+
453
+
454
+ <li class="public ">
455
+ <span class="summary_signature">
456
+
457
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (TableFu) <strong>initialize</strong>(table, column_opts = {}) {|_self| ... }</a>
458
+
459
+
460
+
461
+ </span>
462
+
463
+ <span class="note title constructor">constructor</span>
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+ <span class="summary_desc">
472
+ Should be initialized with a matrix array or a string containing a csv, and
473
+ expects the first array in the matrix to be column headers.
474
+
475
+ </span>
476
+
477
+ </li>
478
+
479
+
480
+ <li class="public ">
481
+ <span class="summary_signature">
482
+
483
+ <a href="#only%21-instance_method" title="#only! (instance method)">- (Object) <strong>only!</strong>(range) </a>
484
+
485
+
486
+
487
+ </span>
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+ <span class="summary_desc">
496
+ Inverse slice: Only keep the rows in the range after sorting.
497
+
498
+ </span>
499
+
500
+ </li>
501
+
502
+
503
+ <li class="public ">
504
+ <span class="summary_signature">
505
+
506
+ <a href="#row_at-instance_method" title="#row_at (instance method)">- (Object) <strong>row_at</strong>(row_num) </a>
507
+
508
+
509
+
510
+ </span>
511
+
512
+
513
+
514
+
515
+
516
+
517
+
518
+ <span class="summary_desc">
519
+ Returns a Row object for the row at a certain index.
520
+
521
+ </span>
522
+
523
+ </li>
524
+
525
+
526
+ <li class="public ">
527
+ <span class="summary_signature">
528
+
529
+ <a href="#rows-instance_method" title="#rows (instance method)">- (Object) <strong>rows</strong> </a>
530
+
531
+
532
+
533
+ </span>
534
+
535
+
536
+
537
+
538
+
539
+
540
+
541
+ <span class="summary_desc">
542
+ Returns all the Row objects for this object as a collection.
543
+
544
+ </span>
545
+
546
+ </li>
547
+
548
+
549
+ <li class="public ">
550
+ <span class="summary_signature">
551
+
552
+ <a href="#sorted_by-instance_method" title="#sorted_by (instance method)">- (Object) <strong>sorted_by</strong> </a>
553
+
554
+
555
+
556
+ </span>
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+ <span class="summary_desc">
565
+ Return the sorted_by column.
566
+
567
+ </span>
568
+
569
+ </li>
570
+
571
+
572
+ <li class="public ">
573
+ <span class="summary_signature">
574
+
575
+ <a href="#sorted_by%3D-instance_method" title="#sorted_by= (instance method)">- (Object) <strong>sorted_by</strong>(header) </a>
576
+
577
+
578
+
579
+ </span>
580
+
581
+
582
+
583
+
584
+
585
+
586
+
587
+ <span class="summary_desc">
588
+ Set the sorted_by column.
589
+
590
+ </span>
591
+
592
+ </li>
593
+
594
+
595
+ <li class="public ">
596
+ <span class="summary_signature">
597
+
598
+ <a href="#sum_totals_for-instance_method" title="#sum_totals_for (instance method)">- (Object) <strong>sum_totals_for</strong>(column) </a>
599
+
600
+
601
+
602
+ </span>
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+ <span class="summary_desc">
611
+ Sum the values of a particular column.
612
+
613
+ </span>
614
+
615
+ </li>
616
+
617
+
618
+ <li class="public ">
619
+ <span class="summary_signature">
620
+
621
+ <a href="#to_numeric-instance_method" title="#to_numeric (instance method)">- (Object) <strong>to_numeric</strong>(num) </a>
622
+
623
+
624
+
625
+ </span>
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+ <span class="summary_desc">
634
+ Return a numeric instance for a string number, or if it&#8217;s a string we
635
+ return 1, this way if we total up a series of strings it&#8217;s a count.
636
+
637
+ </span>
638
+
639
+ </li>
640
+
641
+
642
+ <li class="public ">
643
+ <span class="summary_signature">
644
+
645
+ <a href="#total_for-instance_method" title="#total_for (instance method)">- (Object) <strong>total_for</strong>(column) </a>
646
+
647
+
648
+
649
+ </span>
650
+
651
+
652
+
653
+
654
+
655
+
656
+
657
+ <span class="summary_desc">
658
+ Sum the values of a particular column and return a Datum.
659
+
660
+ </span>
661
+
662
+ </li>
663
+
664
+
665
+ </ul>
666
+ <div id="constructor_details" class="method_details_list">
667
+ <h2>Constructor Details</h2>
668
+
669
+ <div class="method_details first">
670
+ <p class="signature first" id="initialize-instance_method">
671
+
672
+ - (<tt><a href="" title="TableFu (class)">TableFu</a></tt>) <strong>initialize</strong>(table, column_opts = {}) {|_self| ... }
673
+
674
+
675
+
676
+ </p><div class="docstring">
677
+ <div class="discussion">
678
+ <p>
679
+ Should be initialized with a matrix array or a string containing a csv, and
680
+ expects the first array in the matrix to be column headers.
681
+ </p>
682
+
683
+
684
+ </div>
685
+ </div>
686
+ <div class="tags">
687
+ <h3>Yields:</h3>
688
+ <ul class="yield">
689
+
690
+ <li>
691
+
692
+ <span class='type'>(<tt>_self</tt>)</span>
693
+
694
+
695
+
696
+
697
+ </li>
698
+
699
+ </ul>
700
+ <h3>Yield Parameters:</h3>
701
+ <ul class="yieldparam">
702
+
703
+ <li>
704
+
705
+ <span class='type'>(<tt><a href="" title="TableFu (class)">TableFu</a></tt>)</span>
706
+
707
+
708
+ <span class='name'>_self</span>
709
+
710
+
711
+
712
+ &mdash;
713
+
714
+ the object that the method was called on
715
+
716
+
717
+
718
+ </li>
719
+
720
+ </ul>
721
+
722
+ </div><table class="source_code">
723
+ <tr>
724
+ <td>
725
+ <pre class="lines">
726
+
727
+
728
+ 18
729
+ 19
730
+ 20
731
+ 21
732
+ 22
733
+ 23
734
+ 24
735
+ 25
736
+ 26
737
+ 27
738
+ 28</pre>
739
+ </td>
740
+ <td>
741
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 18</span>
742
+
743
+ <span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='table identifier id'>table</span><span class='comma token'>,</span> <span class='column_opts identifier id'>column_opts</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
744
+ <span class='comment val'># Assume if we're past a string or filehandle we need to parse a csv</span>
745
+ <span class='if if kw'>if</span> <span class='table identifier id'>table</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='String constant id'>String</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='table identifier id'>table</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='File constant id'>File</span><span class='rparen token'>)</span>
746
+ <span class='table identifier id'>table</span> <span class='assign token'>=</span> <span class='FasterCSV constant id'>FasterCSV</span><span class='dot token'>.</span><span class='parse identifier id'>parse</span><span class='lparen token'>(</span><span class='table identifier id'>table</span><span class='rparen token'>)</span>
747
+ <span class='end end kw'>end</span>
748
+ <span class='@column_headers ivar id'>@column_headers</span> <span class='assign token'>=</span> <span class='table identifier id'>table</span><span class='dot token'>.</span><span class='slice! fid id'>slice!</span><span class='lparen token'>(</span><span class='integer val'>0</span><span class='rparen token'>)</span>
749
+ <span class='@totals ivar id'>@totals</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
750
+ <span class='@table ivar id'>@table</span> <span class='assign token'>=</span> <span class='table identifier id'>table</span>
751
+ <span class='@col_opts ivar id'>@col_opts</span> <span class='assign token'>=</span> <span class='column_opts identifier id'>column_opts</span>
752
+ <span class='yield yield kw'>yield</span> <span class='self self kw'>self</span> <span class='if if_mod kw'>if</span> <span class='block_given? fid id'>block_given?</span>
753
+ <span class='end end kw'>end</span>
754
+ </pre>
755
+ </td>
756
+ </tr>
757
+ </table>
758
+ </div>
759
+
760
+ </div>
761
+
762
+ <div id="instance_attr_details" class="attr_details">
763
+ <h2>Instance Attribute Details</h2>
764
+
765
+
766
+ <span id="col_opts=-instance_method"></span>
767
+ <span id="col_opts-instance_method"></span>
768
+ <div class="method_details first">
769
+ <p class="signature first" id="col_opts-instance_method">
770
+
771
+ - (<tt>Object</tt>) <strong>col_opts</strong>
772
+
773
+
774
+
775
+ </p><div class="docstring">
776
+ <div class="discussion">
777
+ <p>
778
+ Returns the value of attribute col_opts
779
+ </p>
780
+
781
+
782
+ </div>
783
+ </div>
784
+ <div class="tags">
785
+
786
+ </div><table class="source_code">
787
+ <tr>
788
+ <td>
789
+ <pre class="lines">
790
+
791
+
792
+ 14
793
+ 15
794
+ 16</pre>
795
+ </td>
796
+ <td>
797
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 14</span>
798
+
799
+ <span class='def def kw'>def</span> <span class='col_opts identifier id'>col_opts</span>
800
+ <span class='@col_opts ivar id'>@col_opts</span>
801
+ <span class='end end kw'>end</span>
802
+ </pre>
803
+ </td>
804
+ </tr>
805
+ </table>
806
+ </div>
807
+
808
+
809
+ <span id=""></span>
810
+ <span id="column_headers-instance_method"></span>
811
+ <div class="method_details ">
812
+ <p class="signature " id="column_headers-instance_method">
813
+
814
+ - (<tt>Object</tt>) <strong>column_headers</strong> <span class="extras">(readonly)</span>
815
+
816
+
817
+
818
+ </p><div class="docstring">
819
+ <div class="discussion">
820
+ <p>
821
+ Returns the value of attribute column_headers
822
+ </p>
823
+
824
+
825
+ </div>
826
+ </div>
827
+ <div class="tags">
828
+
829
+ </div><table class="source_code">
830
+ <tr>
831
+ <td>
832
+ <pre class="lines">
833
+
834
+
835
+ 13
836
+ 14
837
+ 15</pre>
838
+ </td>
839
+ <td>
840
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 13</span>
841
+
842
+ <span class='def def kw'>def</span> <span class='column_headers identifier id'>column_headers</span>
843
+ <span class='@column_headers ivar id'>@column_headers</span>
844
+ <span class='end end kw'>end</span>
845
+ </pre>
846
+ </td>
847
+ </tr>
848
+ </table>
849
+ </div>
850
+
851
+
852
+ <span id=""></span>
853
+ <span id="deleted_rows-instance_method"></span>
854
+ <div class="method_details ">
855
+ <p class="signature " id="deleted_rows-instance_method">
856
+
857
+ - (<tt>Object</tt>) <strong>deleted_rows</strong> <span class="extras">(readonly)</span>
858
+
859
+
860
+
861
+ </p><div class="docstring">
862
+ <div class="discussion">
863
+ <p>
864
+ Returns the value of attribute deleted_rows
865
+ </p>
866
+
867
+
868
+ </div>
869
+ </div>
870
+ <div class="tags">
871
+
872
+ </div><table class="source_code">
873
+ <tr>
874
+ <td>
875
+ <pre class="lines">
876
+
877
+
878
+ 13
879
+ 14
880
+ 15</pre>
881
+ </td>
882
+ <td>
883
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 13</span>
884
+
885
+ <span class='def def kw'>def</span> <span class='deleted_rows identifier id'>deleted_rows</span>
886
+ <span class='@deleted_rows ivar id'>@deleted_rows</span>
887
+ <span class='end end kw'>end</span>
888
+ </pre>
889
+ </td>
890
+ </tr>
891
+ </table>
892
+ </div>
893
+
894
+
895
+ <span id="faceted_on=-instance_method"></span>
896
+ <span id="faceted_on-instance_method"></span>
897
+ <div class="method_details ">
898
+ <p class="signature " id="faceted_on-instance_method">
899
+
900
+ - (<tt>Object</tt>) <strong>faceted_on</strong>
901
+
902
+
903
+
904
+ </p><div class="docstring">
905
+ <div class="discussion">
906
+ <p>
907
+ Returns the value of attribute faceted_on
908
+ </p>
909
+
910
+
911
+ </div>
912
+ </div>
913
+ <div class="tags">
914
+
915
+ </div><table class="source_code">
916
+ <tr>
917
+ <td>
918
+ <pre class="lines">
919
+
920
+
921
+ 14
922
+ 15
923
+ 16</pre>
924
+ </td>
925
+ <td>
926
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 14</span>
927
+
928
+ <span class='def def kw'>def</span> <span class='faceted_on identifier id'>faceted_on</span>
929
+ <span class='@faceted_on ivar id'>@faceted_on</span>
930
+ <span class='end end kw'>end</span>
931
+ </pre>
932
+ </td>
933
+ </tr>
934
+ </table>
935
+ </div>
936
+
937
+
938
+ <span id=""></span>
939
+ <span id="table-instance_method"></span>
940
+ <div class="method_details ">
941
+ <p class="signature " id="table-instance_method">
942
+
943
+ - (<tt>Object</tt>) <strong>table</strong> <span class="extras">(readonly)</span>
944
+
945
+
946
+
947
+ </p><div class="docstring">
948
+ <div class="discussion">
949
+ <p>
950
+ Returns the value of attribute table
951
+ </p>
952
+
953
+
954
+ </div>
955
+ </div>
956
+ <div class="tags">
957
+
958
+ </div><table class="source_code">
959
+ <tr>
960
+ <td>
961
+ <pre class="lines">
962
+
963
+
964
+ 13
965
+ 14
966
+ 15</pre>
967
+ </td>
968
+ <td>
969
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 13</span>
970
+
971
+ <span class='def def kw'>def</span> <span class='table identifier id'>table</span>
972
+ <span class='@table ivar id'>@table</span>
973
+ <span class='end end kw'>end</span>
974
+ </pre>
975
+ </td>
976
+ </tr>
977
+ </table>
978
+ </div>
979
+
980
+
981
+ <span id=""></span>
982
+ <span id="totals-instance_method"></span>
983
+ <div class="method_details ">
984
+ <p class="signature " id="totals-instance_method">
985
+
986
+ - (<tt>Object</tt>) <strong>totals</strong> <span class="extras">(readonly)</span>
987
+
988
+
989
+
990
+ </p><div class="docstring">
991
+ <div class="discussion">
992
+ <p>
993
+ Returns the value of attribute totals
994
+ </p>
995
+
996
+
997
+ </div>
998
+ </div>
999
+ <div class="tags">
1000
+
1001
+ </div><table class="source_code">
1002
+ <tr>
1003
+ <td>
1004
+ <pre class="lines">
1005
+
1006
+
1007
+ 13
1008
+ 14
1009
+ 15</pre>
1010
+ </td>
1011
+ <td>
1012
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 13</span>
1013
+
1014
+ <span class='def def kw'>def</span> <span class='totals identifier id'>totals</span>
1015
+ <span class='@totals ivar id'>@totals</span>
1016
+ <span class='end end kw'>end</span>
1017
+ </pre>
1018
+ </td>
1019
+ </tr>
1020
+ </table>
1021
+ </div>
1022
+
1023
+ </div>
1024
+
1025
+
1026
+ <div id="instance_method_details" class="method_details_list">
1027
+ <h2>Instance Method Details</h2>
1028
+
1029
+
1030
+ <div class="method_details first">
1031
+ <p class="signature first" id="columns-instance_method">
1032
+
1033
+ - (<tt>Object</tt>) <strong>columns</strong>
1034
+
1035
+
1036
+
1037
+ </p><div class="docstring">
1038
+ <div class="discussion">
1039
+ <p>
1040
+ Return the headers defined in column headers or cherry picked from
1041
+ @col_opts
1042
+ </p>
1043
+
1044
+
1045
+ </div>
1046
+ </div>
1047
+ <div class="tags">
1048
+
1049
+ </div><table class="source_code">
1050
+ <tr>
1051
+ <td>
1052
+ <pre class="lines">
1053
+
1054
+
1055
+ 70
1056
+ 71
1057
+ 72</pre>
1058
+ </td>
1059
+ <td>
1060
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 70</span>
1061
+
1062
+ <span class='def def kw'>def</span> <span class='columns identifier id'>columns</span>
1063
+ <span class='@col_opts ivar id'>@col_opts</span><span class='lbrack token'>[</span><span class='symbol val'>:columns</span><span class='rbrack token'>]</span> <span class='orop op'>||</span> <span class='column_headers identifier id'>column_headers</span>
1064
+ <span class='end end kw'>end</span>
1065
+ </pre>
1066
+ </td>
1067
+ </tr>
1068
+ </table>
1069
+ </div>
1070
+
1071
+ <div class="method_details ">
1072
+ <p class="signature " id="columns=-instance_method">
1073
+
1074
+ - (<tt>Object</tt>) <strong>columns=</strong>(array)
1075
+
1076
+
1077
+
1078
+ </p><div class="docstring">
1079
+ <div class="discussion">
1080
+ <p>
1081
+ Set up the cherry picked columns
1082
+ </p>
1083
+
1084
+
1085
+ </div>
1086
+ </div>
1087
+ <div class="tags">
1088
+
1089
+ </div><table class="source_code">
1090
+ <tr>
1091
+ <td>
1092
+ <pre class="lines">
1093
+
1094
+
1095
+ 167
1096
+ 168
1097
+ 169</pre>
1098
+ </td>
1099
+ <td>
1100
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 167</span>
1101
+
1102
+ <span class='def def kw'>def</span> <span class='columns= identifier id'>columns=</span><span class='lparen token'>(</span><span class='array identifier id'>array</span><span class='rparen token'>)</span>
1103
+ <span class='@col_opts ivar id'>@col_opts</span><span class='lbrack token'>[</span><span class='symbol val'>:columns</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='array identifier id'>array</span>
1104
+ <span class='end end kw'>end</span>
1105
+ </pre>
1106
+ </td>
1107
+ </tr>
1108
+ </table>
1109
+ </div>
1110
+
1111
+ <div class="method_details ">
1112
+ <p class="signature " id="delete_rows!-instance_method">
1113
+
1114
+ - (<tt>Object</tt>) <strong>delete_rows!</strong>(arr)
1115
+
1116
+
1117
+
1118
+ </p><div class="docstring">
1119
+ <div class="discussion">
1120
+ <p>
1121
+ Pass it an array and it will delete it from the table, but save the data in
1122
+ @deleted_rows@ for later perusal.
1123
+ </p>
1124
+ <p>
1125
+ Returns: nothing
1126
+ </p>
1127
+
1128
+
1129
+ </div>
1130
+ </div>
1131
+ <div class="tags">
1132
+
1133
+ </div><table class="source_code">
1134
+ <tr>
1135
+ <td>
1136
+ <pre class="lines">
1137
+
1138
+
1139
+ 37
1140
+ 38
1141
+ 39
1142
+ 40
1143
+ 41
1144
+ 42
1145
+ 43
1146
+ 44</pre>
1147
+ </td>
1148
+ <td>
1149
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 37</span>
1150
+
1151
+ <span class='def def kw'>def</span> <span class='delete_rows! fid id'>delete_rows!</span><span class='lparen token'>(</span><span class='arr identifier id'>arr</span><span class='rparen token'>)</span>
1152
+ <span class='@deleted_rows ivar id'>@deleted_rows</span> <span class='opasgn op'>||=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
1153
+ <span class='arr identifier id'>arr</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='item identifier id'>item</span><span class='bitor op'>|</span>
1154
+ <span class='@deleted_rows ivar id'>@deleted_rows</span> <span class='lshft op'>&lt;&lt;</span> <span class='@table ivar id'>@table</span><span class='lbrack token'>[</span><span class='item identifier id'>item</span><span class='rbrack token'>]</span> <span class='comment val'>#account for header and 0 index</span>
1155
+ <span class='@table ivar id'>@table</span><span class='lbrack token'>[</span><span class='item identifier id'>item</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='nil nil kw'>nil</span>
1156
+ <span class='end end kw'>end</span>
1157
+ <span class='@table ivar id'>@table</span><span class='dot token'>.</span><span class='compact! fid id'>compact!</span>
1158
+ <span class='end end kw'>end</span>
1159
+ </pre>
1160
+ </td>
1161
+ </tr>
1162
+ </table>
1163
+ </div>
1164
+
1165
+ <div class="method_details ">
1166
+ <p class="signature " id="faceted?-instance_method">
1167
+
1168
+ - (<tt>Boolean</tt>) <strong>faceted?</strong>
1169
+
1170
+
1171
+
1172
+ </p><div class="docstring">
1173
+ <div class="discussion">
1174
+ <p>
1175
+ Return true if this table is faceted
1176
+ </p>
1177
+
1178
+
1179
+ </div>
1180
+ </div>
1181
+ <div class="tags">
1182
+ <h3>Returns:</h3>
1183
+ <ul class="return">
1184
+
1185
+ <li>
1186
+
1187
+ <span class='type'>(<tt>Boolean</tt>)</span>
1188
+
1189
+
1190
+
1191
+
1192
+ </li>
1193
+
1194
+ </ul>
1195
+
1196
+ </div><table class="source_code">
1197
+ <tr>
1198
+ <td>
1199
+ <pre class="lines">
1200
+
1201
+
1202
+ 142
1203
+ 143
1204
+ 144</pre>
1205
+ </td>
1206
+ <td>
1207
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 142</span>
1208
+
1209
+ <span class='def def kw'>def</span> <span class='faceted? fid id'>faceted?</span>
1210
+ <span class='not not kw'>not</span> <span class='faceted_on identifier id'>faceted_on</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
1211
+ <span class='end end kw'>end</span>
1212
+ </pre>
1213
+ </td>
1214
+ </tr>
1215
+ </table>
1216
+ </div>
1217
+
1218
+ <div class="method_details ">
1219
+ <p class="signature " id="faceted_by-instance_method">
1220
+
1221
+ - (<tt>Object</tt>) <strong>faceted_by</strong>(column, opts = {})
1222
+
1223
+
1224
+
1225
+ </p><div class="docstring">
1226
+ <div class="discussion">
1227
+ <p>
1228
+ Return an array of TableFu instances grouped by a column.
1229
+ </p>
1230
+
1231
+
1232
+ </div>
1233
+ </div>
1234
+ <div class="tags">
1235
+
1236
+ </div><table class="source_code">
1237
+ <tr>
1238
+ <td>
1239
+ <pre class="lines">
1240
+
1241
+
1242
+ 95
1243
+ 96
1244
+ 97
1245
+ 98
1246
+ 99
1247
+ 100
1248
+ 101
1249
+ 102
1250
+ 103
1251
+ 104
1252
+ 105
1253
+ 106
1254
+ 107
1255
+ 108
1256
+ 109
1257
+ 110
1258
+ 111
1259
+ 112
1260
+ 113
1261
+ 114
1262
+ 115
1263
+ 116
1264
+ 117
1265
+ 118
1266
+ 119
1267
+ 120
1268
+ 121
1269
+ 122
1270
+ 123
1271
+ 124
1272
+ 125
1273
+ 126
1274
+ 127</pre>
1275
+ </td>
1276
+ <td>
1277
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 95</span>
1278
+
1279
+ <span class='def def kw'>def</span> <span class='faceted_by identifier id'>faceted_by</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='comma token'>,</span> <span class='opts identifier id'>opts</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
1280
+ <span class='faceted_spreadsheets identifier id'>faceted_spreadsheets</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='rbrace token'>}</span>
1281
+ <span class='rows identifier id'>rows</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='row identifier id'>row</span><span class='bitor op'>|</span>
1282
+ <span class='unless unless kw'>unless</span> <span class='row identifier id'>row</span><span class='dot token'>.</span><span class='column_for identifier id'>column_for</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
1283
+ <span class='faceted_spreadsheets identifier id'>faceted_spreadsheets</span><span class='lbrack token'>[</span><span class='row identifier id'>row</span><span class='dot token'>.</span><span class='column_for identifier id'>column_for</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='rbrack token'>]</span> <span class='opasgn op'>||=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
1284
+ <span class='faceted_spreadsheets identifier id'>faceted_spreadsheets</span><span class='lbrack token'>[</span><span class='row identifier id'>row</span><span class='dot token'>.</span><span class='column_for identifier id'>column_for</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='rbrack token'>]</span> <span class='lshft op'>&lt;&lt;</span> <span class='row identifier id'>row</span>
1285
+ <span class='end end kw'>end</span>
1286
+ <span class='end end kw'>end</span>
1287
+
1288
+ <span class='comment val'># Create new table_fu instances for each facet</span>
1289
+ <span class='tables identifier id'>tables</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
1290
+ <span class='faceted_spreadsheets identifier id'>faceted_spreadsheets</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='key identifier id'>key</span><span class='comma token'>,</span><span class='value identifier id'>value</span><span class='bitor op'>|</span>
1291
+ <span class='new_table identifier id'>new_table</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='@column_headers ivar id'>@column_headers</span><span class='rbrack token'>]</span> <span class='plus op'>+</span> <span class='value identifier id'>value</span>
1292
+ <span class='table identifier id'>table</span> <span class='assign token'>=</span> <span class='TableFu constant id'>TableFu</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='new_table identifier id'>new_table</span><span class='rparen token'>)</span>
1293
+ <span class='table identifier id'>table</span><span class='dot token'>.</span><span class='faceted_on identifier id'>faceted_on</span> <span class='assign token'>=</span> <span class='key identifier id'>key</span>
1294
+ <span class='table identifier id'>table</span><span class='dot token'>.</span><span class='col_opts identifier id'>col_opts</span> <span class='assign token'>=</span> <span class='@col_opts ivar id'>@col_opts</span> <span class='comment val'>#formatting should be carried through</span>
1295
+ <span class='tables identifier id'>tables</span> <span class='lshft op'>&lt;&lt;</span> <span class='table identifier id'>table</span>
1296
+ <span class='end end kw'>end</span>
1297
+
1298
+ <span class='tables identifier id'>tables</span><span class='dot token'>.</span><span class='sort! fid id'>sort!</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='a identifier id'>a</span><span class='comma token'>,</span><span class='b identifier id'>b</span><span class='bitor op'>|</span>
1299
+ <span class='a identifier id'>a</span><span class='dot token'>.</span><span class='faceted_on identifier id'>faceted_on</span> <span class='cmp op'>&lt;=&gt;</span> <span class='b identifier id'>b</span><span class='dot token'>.</span><span class='faceted_on identifier id'>faceted_on</span>
1300
+ <span class='end end kw'>end</span>
1301
+
1302
+ <span class='if if kw'>if</span> <span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='symbol val'>:total</span><span class='rbrack token'>]</span>
1303
+ <span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='symbol val'>:total</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='c identifier id'>c</span><span class='bitor op'>|</span>
1304
+ <span class='tables identifier id'>tables</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='f identifier id'>f</span><span class='bitor op'>|</span>
1305
+ <span class='f identifier id'>f</span><span class='dot token'>.</span><span class='sum_totals_for identifier id'>sum_totals_for</span><span class='lparen token'>(</span><span class='c identifier id'>c</span><span class='rparen token'>)</span>
1306
+ <span class='end end kw'>end</span>
1307
+ <span class='end end kw'>end</span>
1308
+ <span class='end end kw'>end</span>
1309
+
1310
+ <span class='tables identifier id'>tables</span>
1311
+ <span class='end end kw'>end</span>
1312
+ </pre>
1313
+ </td>
1314
+ </tr>
1315
+ </table>
1316
+ </div>
1317
+
1318
+ <div class="method_details ">
1319
+ <p class="signature " id="formatting-instance_method">
1320
+
1321
+ - (<tt>Object</tt>) <strong>formatting</strong>
1322
+
1323
+
1324
+
1325
+ </p><div class="docstring">
1326
+ <div class="discussion">
1327
+ <p>
1328
+ Return the formatting hash
1329
+ </p>
1330
+
1331
+
1332
+ </div>
1333
+ </div>
1334
+ <div class="tags">
1335
+
1336
+ </div><table class="source_code">
1337
+ <tr>
1338
+ <td>
1339
+ <pre class="lines">
1340
+
1341
+
1342
+ 157
1343
+ 158
1344
+ 159</pre>
1345
+ </td>
1346
+ <td>
1347
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 157</span>
1348
+
1349
+ <span class='def def kw'>def</span> <span class='formatting identifier id'>formatting</span>
1350
+ <span class='@col_opts ivar id'>@col_opts</span><span class='lbrack token'>[</span><span class='symbol val'>:formatting</span><span class='rbrack token'>]</span>
1351
+ <span class='end end kw'>end</span>
1352
+ </pre>
1353
+ </td>
1354
+ </tr>
1355
+ </table>
1356
+ </div>
1357
+
1358
+ <div class="method_details ">
1359
+ <p class="signature " id="formatting=-instance_method">
1360
+
1361
+ - (<tt>Object</tt>) <strong>formatting=</strong>(headers)
1362
+
1363
+
1364
+
1365
+ </p><div class="docstring">
1366
+ <div class="discussion">
1367
+ <p>
1368
+ Set the formatting hash
1369
+ </p>
1370
+
1371
+
1372
+ </div>
1373
+ </div>
1374
+ <div class="tags">
1375
+
1376
+ </div><table class="source_code">
1377
+ <tr>
1378
+ <td>
1379
+ <pre class="lines">
1380
+
1381
+
1382
+ 162
1383
+ 163
1384
+ 164</pre>
1385
+ </td>
1386
+ <td>
1387
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 162</span>
1388
+
1389
+ <span class='def def kw'>def</span> <span class='formatting= identifier id'>formatting=</span><span class='lparen token'>(</span><span class='headers identifier id'>headers</span><span class='rparen token'>)</span>
1390
+ <span class='@col_opts ivar id'>@col_opts</span><span class='lbrack token'>[</span><span class='symbol val'>:formatting</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='headers identifier id'>headers</span>
1391
+ <span class='end end kw'>end</span>
1392
+ </pre>
1393
+ </td>
1394
+ </tr>
1395
+ </table>
1396
+ </div>
1397
+
1398
+ <div class="method_details ">
1399
+ <p class="signature " id="headers-instance_method">
1400
+
1401
+ - (<tt>Object</tt>) <strong>headers</strong>
1402
+
1403
+
1404
+
1405
+ </p><div class="docstring">
1406
+ <div class="discussion">
1407
+ <p>
1408
+ Return the headers of the array
1409
+ </p>
1410
+
1411
+
1412
+ </div>
1413
+ </div>
1414
+ <div class="tags">
1415
+
1416
+ </div><table class="source_code">
1417
+ <tr>
1418
+ <td>
1419
+ <pre class="lines">
1420
+
1421
+
1422
+ 75
1423
+ 76
1424
+ 77
1425
+ 78
1426
+ 79
1427
+ 80
1428
+ 81</pre>
1429
+ </td>
1430
+ <td>
1431
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 75</span>
1432
+
1433
+ <span class='def def kw'>def</span> <span class='headers identifier id'>headers</span>
1434
+ <span class='all_columns identifier id'>all_columns</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
1435
+ <span class='columns identifier id'>columns</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='header identifier id'>header</span><span class='bitor op'>|</span>
1436
+ <span class='all_columns identifier id'>all_columns</span> <span class='lshft op'>&lt;&lt;</span> <span class='TableFu constant id'>TableFu</span><span class='colon2 op'>::</span><span class='Header constant id'>Header</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='header identifier id'>header</span><span class='comma token'>,</span> <span class='header identifier id'>header</span><span class='comma token'>,</span> <span class='nil nil kw'>nil</span><span class='comma token'>,</span> <span class='self self kw'>self</span><span class='rparen token'>)</span>
1437
+ <span class='end end kw'>end</span>
1438
+ <span class='all_columns identifier id'>all_columns</span>
1439
+ <span class='end end kw'>end</span>
1440
+ </pre>
1441
+ </td>
1442
+ </tr>
1443
+ </table>
1444
+ </div>
1445
+
1446
+ <div class="method_details ">
1447
+ <p class="signature " id="only!-instance_method">
1448
+
1449
+ - (<tt>Object</tt>) <strong>only!</strong>(range)
1450
+
1451
+
1452
+
1453
+ </p><div class="docstring">
1454
+ <div class="discussion">
1455
+ <p>
1456
+ Inverse slice: Only keep the rows in the range after sorting
1457
+ </p>
1458
+
1459
+
1460
+ </div>
1461
+ </div>
1462
+ <div class="tags">
1463
+
1464
+ </div><table class="source_code">
1465
+ <tr>
1466
+ <td>
1467
+ <pre class="lines">
1468
+
1469
+
1470
+ 48
1471
+ 49
1472
+ 50
1473
+ 51
1474
+ 52
1475
+ 53</pre>
1476
+ </td>
1477
+ <td>
1478
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 48</span>
1479
+
1480
+ <span class='def def kw'>def</span> <span class='only! fid id'>only!</span><span class='lparen token'>(</span><span class='range identifier id'>range</span><span class='rparen token'>)</span>
1481
+ <span class='rows_to_exclude identifier id'>rows_to_exclude</span> <span class='assign token'>=</span> <span class='rows identifier id'>rows</span><span class='dot token'>.</span><span class='map identifier id'>map</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='row identifier id'>row</span><span class='bitor op'>|</span>
1482
+ <span class='range identifier id'>range</span><span class='dot token'>.</span><span class='include? fid id'>include?</span><span class='lparen token'>(</span><span class='row identifier id'>row</span><span class='dot token'>.</span><span class='row_num identifier id'>row_num</span><span class='rparen token'>)</span> <span class='question op'>?</span> <span class='nil nil kw'>nil</span> <span class='colon op'>:</span> <span class='row identifier id'>row</span><span class='dot token'>.</span><span class='row_num identifier id'>row_num</span>
1483
+ <span class='end end kw'>end</span>
1484
+ <span class='delete_rows! fid id'>delete_rows!</span><span class='lparen token'>(</span><span class='rows_to_exclude identifier id'>rows_to_exclude</span><span class='dot token'>.</span><span class='compact identifier id'>compact</span><span class='rparen token'>)</span>
1485
+ <span class='end end kw'>end</span>
1486
+ </pre>
1487
+ </td>
1488
+ </tr>
1489
+ </table>
1490
+ </div>
1491
+
1492
+ <div class="method_details ">
1493
+ <p class="signature " id="row_at-instance_method">
1494
+
1495
+ - (<tt>Object</tt>) <strong>row_at</strong>(row_num)
1496
+
1497
+
1498
+
1499
+ </p><div class="docstring">
1500
+ <div class="discussion">
1501
+ <p>
1502
+ Returns a Row object for the row at a certain index
1503
+ </p>
1504
+
1505
+
1506
+ </div>
1507
+ </div>
1508
+ <div class="tags">
1509
+
1510
+ </div><table class="source_code">
1511
+ <tr>
1512
+ <td>
1513
+ <pre class="lines">
1514
+
1515
+
1516
+ 56
1517
+ 57
1518
+ 58</pre>
1519
+ </td>
1520
+ <td>
1521
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 56</span>
1522
+
1523
+ <span class='def def kw'>def</span> <span class='row_at identifier id'>row_at</span><span class='lparen token'>(</span><span class='row_num identifier id'>row_num</span><span class='rparen token'>)</span>
1524
+ <span class='TableFu constant id'>TableFu</span><span class='colon2 op'>::</span><span class='Row constant id'>Row</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='@table ivar id'>@table</span><span class='lbrack token'>[</span><span class='row_num identifier id'>row_num</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='row_num identifier id'>row_num</span><span class='comma token'>,</span> <span class='self self kw'>self</span><span class='rparen token'>)</span>
1525
+ <span class='end end kw'>end</span>
1526
+ </pre>
1527
+ </td>
1528
+ </tr>
1529
+ </table>
1530
+ </div>
1531
+
1532
+ <div class="method_details ">
1533
+ <p class="signature " id="rows-instance_method">
1534
+
1535
+ - (<tt>Object</tt>) <strong>rows</strong>
1536
+
1537
+
1538
+
1539
+ </p><div class="docstring">
1540
+ <div class="discussion">
1541
+ <p>
1542
+ Returns all the Row objects for this object as a collection
1543
+ </p>
1544
+
1545
+
1546
+ </div>
1547
+ </div>
1548
+ <div class="tags">
1549
+
1550
+ </div><table class="source_code">
1551
+ <tr>
1552
+ <td>
1553
+ <pre class="lines">
1554
+
1555
+
1556
+ 61
1557
+ 62
1558
+ 63
1559
+ 64
1560
+ 65
1561
+ 66
1562
+ 67</pre>
1563
+ </td>
1564
+ <td>
1565
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 61</span>
1566
+
1567
+ <span class='def def kw'>def</span> <span class='rows identifier id'>rows</span>
1568
+ <span class='all_rows identifier id'>all_rows</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
1569
+ <span class='@table ivar id'>@table</span><span class='dot token'>.</span><span class='each_with_index identifier id'>each_with_index</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='row identifier id'>row</span><span class='comma token'>,</span> <span class='index identifier id'>index</span><span class='bitor op'>|</span>
1570
+ <span class='all_rows identifier id'>all_rows</span> <span class='lshft op'>&lt;&lt;</span> <span class='TableFu constant id'>TableFu</span><span class='colon2 op'>::</span><span class='Row constant id'>Row</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='row identifier id'>row</span><span class='comma token'>,</span> <span class='index identifier id'>index</span><span class='comma token'>,</span> <span class='self self kw'>self</span><span class='rparen token'>)</span>
1571
+ <span class='end end kw'>end</span>
1572
+ <span class='all_rows identifier id'>all_rows</span><span class='dot token'>.</span><span class='sort identifier id'>sort</span>
1573
+ <span class='end end kw'>end</span>
1574
+ </pre>
1575
+ </td>
1576
+ </tr>
1577
+ </table>
1578
+ </div>
1579
+
1580
+ <div class="method_details ">
1581
+ <p class="signature " id="sorted_by-instance_method">
1582
+
1583
+ - (<tt>Object</tt>) <strong>sorted_by</strong>
1584
+
1585
+
1586
+
1587
+ </p><div class="docstring">
1588
+ <div class="discussion">
1589
+ <p>
1590
+ Return the sorted_by column
1591
+ </p>
1592
+
1593
+
1594
+ </div>
1595
+ </div>
1596
+ <div class="tags">
1597
+
1598
+ </div><table class="source_code">
1599
+ <tr>
1600
+ <td>
1601
+ <pre class="lines">
1602
+
1603
+
1604
+ 147
1605
+ 148
1606
+ 149</pre>
1607
+ </td>
1608
+ <td>
1609
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 147</span>
1610
+
1611
+ <span class='def def kw'>def</span> <span class='sorted_by identifier id'>sorted_by</span>
1612
+ <span class='@col_opts ivar id'>@col_opts</span><span class='lbrack token'>[</span><span class='symbol val'>:sorted_by</span><span class='rbrack token'>]</span>
1613
+ <span class='end end kw'>end</span>
1614
+ </pre>
1615
+ </td>
1616
+ </tr>
1617
+ </table>
1618
+ </div>
1619
+
1620
+ <div class="method_details ">
1621
+ <p class="signature " id="sorted_by=-instance_method">
1622
+
1623
+ - (<tt>Object</tt>) <strong>sorted_by=</strong>(header)
1624
+
1625
+
1626
+
1627
+ </p><div class="docstring">
1628
+ <div class="discussion">
1629
+ <p>
1630
+ Set the sorted_by column
1631
+ </p>
1632
+
1633
+
1634
+ </div>
1635
+ </div>
1636
+ <div class="tags">
1637
+
1638
+ </div><table class="source_code">
1639
+ <tr>
1640
+ <td>
1641
+ <pre class="lines">
1642
+
1643
+
1644
+ 152
1645
+ 153
1646
+ 154</pre>
1647
+ </td>
1648
+ <td>
1649
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 152</span>
1650
+
1651
+ <span class='def def kw'>def</span> <span class='sorted_by= identifier id'>sorted_by=</span><span class='lparen token'>(</span><span class='header identifier id'>header</span><span class='rparen token'>)</span>
1652
+ <span class='@col_opts ivar id'>@col_opts</span><span class='lbrack token'>[</span><span class='symbol val'>:sorted_by</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='header identifier id'>header</span>
1653
+ <span class='end end kw'>end</span>
1654
+ </pre>
1655
+ </td>
1656
+ </tr>
1657
+ </table>
1658
+ </div>
1659
+
1660
+ <div class="method_details ">
1661
+ <p class="signature " id="sum_totals_for-instance_method">
1662
+
1663
+ - (<tt>Object</tt>) <strong>sum_totals_for</strong>(column)
1664
+
1665
+
1666
+
1667
+ </p><div class="docstring">
1668
+ <div class="discussion">
1669
+ <p>
1670
+ Sum the values of a particular column
1671
+ </p>
1672
+
1673
+
1674
+ </div>
1675
+ </div>
1676
+ <div class="tags">
1677
+
1678
+ </div><table class="source_code">
1679
+ <tr>
1680
+ <td>
1681
+ <pre class="lines">
1682
+
1683
+
1684
+ 84
1685
+ 85
1686
+ 86</pre>
1687
+ </td>
1688
+ <td>
1689
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 84</span>
1690
+
1691
+ <span class='def def kw'>def</span> <span class='sum_totals_for identifier id'>sum_totals_for</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='rparen token'>)</span>
1692
+ <span class='@totals ivar id'>@totals</span><span class='lbrack token'>[</span><span class='column identifier id'>column</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rows identifier id'>rows</span><span class='dot token'>.</span><span class='inject identifier id'>inject</span><span class='lparen token'>(</span><span class='integer val'>0</span><span class='rparen token'>)</span> <span class='lbrace token'>{</span> <span class='bitor op'>|</span><span class='sum identifier id'>sum</span><span class='comma token'>,</span> <span class='r identifier id'>r</span><span class='bitor op'>|</span> <span class='to_numeric identifier id'>to_numeric</span><span class='lparen token'>(</span><span class='r identifier id'>r</span><span class='dot token'>.</span><span class='datum_for identifier id'>datum_for</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='value identifier id'>value</span><span class='rparen token'>)</span> <span class='plus op'>+</span> <span class='sum identifier id'>sum</span> <span class='rbrace token'>}</span>
1693
+ <span class='end end kw'>end</span>
1694
+ </pre>
1695
+ </td>
1696
+ </tr>
1697
+ </table>
1698
+ </div>
1699
+
1700
+ <div class="method_details ">
1701
+ <p class="signature " id="to_numeric-instance_method">
1702
+
1703
+ - (<tt>Object</tt>) <strong>to_numeric</strong>(num)
1704
+
1705
+
1706
+
1707
+ </p><div class="docstring">
1708
+ <div class="discussion">
1709
+ <p>
1710
+ Return a numeric instance for a string number, or if it&#8217;s a string we
1711
+ return 1, this way if we total up a series of strings it&#8217;s a count
1712
+ </p>
1713
+
1714
+
1715
+ </div>
1716
+ </div>
1717
+ <div class="tags">
1718
+
1719
+ </div><table class="source_code">
1720
+ <tr>
1721
+ <td>
1722
+ <pre class="lines">
1723
+
1724
+
1725
+ 131
1726
+ 132
1727
+ 133
1728
+ 134
1729
+ 135
1730
+ 136
1731
+ 137
1732
+ 138
1733
+ 139</pre>
1734
+ </td>
1735
+ <td>
1736
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 131</span>
1737
+
1738
+ <span class='def def kw'>def</span> <span class='to_numeric identifier id'>to_numeric</span><span class='lparen token'>(</span><span class='num identifier id'>num</span><span class='rparen token'>)</span>
1739
+ <span class='if if kw'>if</span> <span class='num identifier id'>num</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
1740
+ <span class='integer val'>0</span>
1741
+ <span class='elsif elsif kw'>elsif</span> <span class='num identifier id'>num</span><span class='dot token'>.</span><span class='kind_of? fid id'>kind_of?</span> <span class='Integer constant id'>Integer</span>
1742
+ <span class='num identifier id'>num</span>
1743
+ <span class='else else kw'>else</span>
1744
+ <span class='integer val'>1</span> <span class='comment val'># We count each instance of a string this way</span>
1745
+ <span class='end end kw'>end</span>
1746
+ <span class='end end kw'>end</span>
1747
+ </pre>
1748
+ </td>
1749
+ </tr>
1750
+ </table>
1751
+ </div>
1752
+
1753
+ <div class="method_details ">
1754
+ <p class="signature " id="total_for-instance_method">
1755
+
1756
+ - (<tt>Object</tt>) <strong>total_for</strong>(column)
1757
+
1758
+
1759
+
1760
+ </p><div class="docstring">
1761
+ <div class="discussion">
1762
+ <p>
1763
+ Sum the values of a particular column and return a Datum
1764
+ </p>
1765
+
1766
+
1767
+ </div>
1768
+ </div>
1769
+ <div class="tags">
1770
+
1771
+ </div><table class="source_code">
1772
+ <tr>
1773
+ <td>
1774
+ <pre class="lines">
1775
+
1776
+
1777
+ 89
1778
+ 90
1779
+ 91
1780
+ 92</pre>
1781
+ </td>
1782
+ <td>
1783
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 89</span>
1784
+
1785
+ <span class='def def kw'>def</span> <span class='total_for identifier id'>total_for</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='rparen token'>)</span>
1786
+ <span class='sum_totals_for identifier id'>sum_totals_for</span><span class='lparen token'>(</span><span class='column identifier id'>column</span><span class='rparen token'>)</span>
1787
+ <span class='Datum constant id'>Datum</span><span class='dot token'>.</span><span class='new identifier id'>new</span><span class='lparen token'>(</span><span class='@totals ivar id'>@totals</span><span class='lbrack token'>[</span><span class='column identifier id'>column</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='column identifier id'>column</span><span class='comma token'>,</span> <span class='nil nil kw'>nil</span><span class='comma token'>,</span> <span class='self self kw'>self</span><span class='rparen token'>)</span>
1788
+ <span class='end end kw'>end</span>
1789
+ </pre>
1790
+ </td>
1791
+ </tr>
1792
+ </table>
1793
+ </div>
1794
+
1795
+ </div>
1796
+
1797
+ </div>
1798
+
1799
+ <div id="footer">
1800
+ Generated on Tue Mar 9 17:16:37 2010 by
1801
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
1802
+ 0.5.3 (ruby-1.8.7).
1803
+ </div>
1804
+
1805
+ </body>
1806
+ </html>