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
@@ -0,0 +1,508 @@
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::Row</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 (R)</a> &raquo;
27
+ <span class='title'><a href="../TableFu.html" title="TableFu (class)">TableFu</a></span>
28
+ &raquo;
29
+ <span class="title">Row</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::Row
47
+
48
+
49
+ </h1>
50
+
51
+ <dl class="box">
52
+
53
+ <dt class="r1">Inherits:</dt>
54
+ <dd class="r1">
55
+ <span class="inheritName">Array</span>
56
+
57
+ <ul class="fullTree">
58
+ <li>Object</li>
59
+
60
+ <li class="next">Array</li>
61
+
62
+ <li class="next">TableFu::Row</li>
63
+
64
+ </ul>
65
+ <a href="#" class="inheritanceTree">show all</a>
66
+
67
+ </dd>
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+ <dt class="r2 last">Defined in:</dt>
77
+ <dd class="r2 last">lib/table_fu.rb</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::Row adds functionality to an row array in a TableFu instance
86
+ </p>
87
+
88
+
89
+ </div>
90
+ </div>
91
+ <div class="tags">
92
+
93
+ </div>
94
+
95
+
96
+ <h2>Instance Attribute Summary</h2>
97
+ <ul class="summary">
98
+
99
+ <li class="public ">
100
+ <span class="summary_signature">
101
+
102
+ <a href="#row_num-instance_method" title="#row_num (instance method)">- (Object) <strong>row_num</strong> </a>
103
+
104
+
105
+
106
+ </span>
107
+
108
+
109
+ <span class="note title readonly">readonly</span>
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <span class="summary_desc">
118
+ Returns the value of attribute row_num.
119
+
120
+ </span>
121
+
122
+ </li>
123
+
124
+
125
+ </ul>
126
+
127
+
128
+ <h2>Instance Method Summary</h2>
129
+
130
+ <ul class="summary">
131
+
132
+ <li class="public ">
133
+ <span class="summary_signature">
134
+
135
+ <a href="#%3C%3D%3E-instance_method" title="#&lt;=&gt; (instance method)">- (Object) <strong>&lt;=&gt;</strong>(b) </a>
136
+
137
+
138
+
139
+ </span>
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ <span class="summary_desc">
148
+ Comparator for sorting a spreadsheet row.
149
+
150
+ </span>
151
+
152
+ </li>
153
+
154
+
155
+ <li class="public ">
156
+ <span class="summary_signature">
157
+
158
+ <a href="#columns-instance_method" title="#columns (instance method)">- (Object) <strong>columns</strong> </a>
159
+
160
+
161
+
162
+ </span>
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <span class="summary_desc"></span>
171
+
172
+ </li>
173
+
174
+
175
+ <li class="public ">
176
+ <span class="summary_signature">
177
+
178
+ <a href="#datum_for-instance_method" title="#datum_for (instance method)">- (Object) <strong>datum_for</strong>(col_name) </a>
179
+
180
+
181
+
182
+ (also: #column_for)
183
+
184
+ </span>
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ <span class="summary_desc">
193
+ This returns a Datum object for a header name.
194
+
195
+ </span>
196
+
197
+ </li>
198
+
199
+
200
+ <li class="public ">
201
+ <span class="summary_signature">
202
+
203
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Row) <strong>initialize</strong>(row, row_num, spreadsheet) </a>
204
+
205
+
206
+
207
+ </span>
208
+
209
+ <span class="note title constructor">constructor</span>
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+ <span class="summary_desc">
218
+ A new instance of Row.
219
+
220
+ </span>
221
+
222
+ </li>
223
+
224
+
225
+ </ul>
226
+
227
+ <div id="constructor_details" class="method_details_list">
228
+ <h2>Constructor Details</h2>
229
+
230
+ <div class="method_details first">
231
+ <p class="signature first" id="initialize-instance_method">
232
+
233
+ - (<tt><a href="" title="TableFu::Row (class)">Row</a></tt>) <strong>initialize</strong>(row, row_num, spreadsheet)
234
+
235
+
236
+
237
+ </p><div class="docstring">
238
+ <div class="discussion">
239
+ <p>
240
+ A new instance of Row
241
+ </p>
242
+
243
+
244
+ </div>
245
+ </div>
246
+ <div class="tags">
247
+
248
+ </div><table class="source_code">
249
+ <tr>
250
+ <td>
251
+ <pre class="lines">
252
+
253
+
254
+ 181
255
+ 182
256
+ 183
257
+ 184
258
+ 185</pre>
259
+ </td>
260
+ <td>
261
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 181</span>
262
+
263
+ <span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='row identifier id'>row</span><span class='comma token'>,</span> <span class='row_num identifier id'>row_num</span><span class='comma token'>,</span> <span class='spreadsheet identifier id'>spreadsheet</span><span class='rparen token'>)</span>
264
+ <span class='self self kw'>self</span><span class='dot token'>.</span><span class='replace identifier id'>replace</span> <span class='row identifier id'>row</span>
265
+ <span class='@row_num ivar id'>@row_num</span> <span class='assign token'>=</span> <span class='row_num identifier id'>row_num</span>
266
+ <span class='@spreadsheet ivar id'>@spreadsheet</span> <span class='assign token'>=</span> <span class='spreadsheet identifier id'>spreadsheet</span>
267
+ <span class='end end kw'>end</span>
268
+ </pre>
269
+ </td>
270
+ </tr>
271
+ </table>
272
+ </div>
273
+
274
+ </div>
275
+
276
+ <div id="instance_attr_details" class="attr_details">
277
+ <h2>Instance Attribute Details</h2>
278
+
279
+
280
+ <span id=""></span>
281
+ <span id="row_num-instance_method"></span>
282
+ <div class="method_details first">
283
+ <p class="signature first" id="row_num-instance_method">
284
+
285
+ - (<tt>Object</tt>) <strong>row_num</strong> <span class="extras">(readonly)</span>
286
+
287
+
288
+
289
+ </p><div class="docstring">
290
+ <div class="discussion">
291
+ <p>
292
+ Returns the value of attribute row_num
293
+ </p>
294
+
295
+
296
+ </div>
297
+ </div>
298
+ <div class="tags">
299
+
300
+ </div><table class="source_code">
301
+ <tr>
302
+ <td>
303
+ <pre class="lines">
304
+
305
+
306
+ 179
307
+ 180
308
+ 181</pre>
309
+ </td>
310
+ <td>
311
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 179</span>
312
+
313
+ <span class='def def kw'>def</span> <span class='row_num identifier id'>row_num</span>
314
+ <span class='@row_num ivar id'>@row_num</span>
315
+ <span class='end end kw'>end</span>
316
+ </pre>
317
+ </td>
318
+ </tr>
319
+ </table>
320
+ </div>
321
+
322
+ </div>
323
+
324
+
325
+ <div id="instance_method_details" class="method_details_list">
326
+ <h2>Instance Method Details</h2>
327
+
328
+
329
+ <div class="method_details first">
330
+ <p class="signature first" id="<=>-instance_method">
331
+
332
+ - (<tt>Object</tt>) <strong>&lt;=&gt;</strong>(b)
333
+
334
+
335
+
336
+ </p><div class="docstring">
337
+ <div class="discussion">
338
+ <p>
339
+ Comparator for sorting a spreadsheet row.
340
+ </p>
341
+
342
+
343
+ </div>
344
+ </div>
345
+ <div class="tags">
346
+
347
+ </div><table class="source_code">
348
+ <tr>
349
+ <td>
350
+ <pre class="lines">
351
+
352
+
353
+ 215
354
+ 216
355
+ 217
356
+ 218
357
+ 219
358
+ 220
359
+ 221
360
+ 222
361
+ 223
362
+ 224
363
+ 225
364
+ 226
365
+ 227
366
+ 228
367
+ 229
368
+ 230
369
+ 231
370
+ 232
371
+ 233</pre>
372
+ </td>
373
+ <td>
374
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 215</span>
375
+
376
+ <span class='def def kw'>def</span> <span class='cmp op'>&lt;=&gt;</span><span class='lparen token'>(</span><span class='b identifier id'>b</span><span class='rparen token'>)</span>
377
+ <span class='if if kw'>if</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='sorted_by identifier id'>sorted_by</span>
378
+ <span class='column identifier id'>column</span> <span class='assign token'>=</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='sorted_by identifier id'>sorted_by</span><span class='dot token'>.</span><span class='keys identifier id'>keys</span><span class='dot token'>.</span><span class='first identifier id'>first</span>
379
+ <span class='order identifier id'>order</span> <span class='assign token'>=</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='sorted_by identifier id'>sorted_by</span><span class='lbrack token'>[</span><span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='sorted_by identifier id'>sorted_by</span><span class='dot token'>.</span><span class='keys identifier id'>keys</span><span class='dot token'>.</span><span class='first identifier id'>first</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='string val'>&quot;order&quot;</span><span class='rbrack token'>]</span>
380
+ <span class='format identifier id'>format</span> <span class='assign token'>=</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='sorted_by identifier id'>sorted_by</span><span class='lbrack token'>[</span><span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='sorted_by identifier id'>sorted_by</span><span class='dot token'>.</span><span class='keys identifier id'>keys</span><span class='dot token'>.</span><span class='first identifier id'>first</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='string val'>&quot;format&quot;</span><span class='rbrack token'>]</span>
381
+ <span class='a identifier id'>a</span> <span class='assign 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='orop op'>||</span> <span class='string val'>''</span>
382
+ <span class='b identifier id'>b</span> <span class='assign token'>=</span> <span class='b identifier id'>b</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='orop op'>||</span> <span class='string val'>''</span>
383
+ <span class='if if kw'>if</span> <span class='format identifier id'>format</span>
384
+ <span class='a identifier id'>a</span> <span class='assign token'>=</span> <span class='TableFu constant id'>TableFu</span><span class='colon2 op'>::</span><span class='Formatting constant id'>Formatting</span><span class='dot token'>.</span><span class='send identifier id'>send</span><span class='lparen token'>(</span><span class='format identifier id'>format</span><span class='comma token'>,</span> <span class='a identifier id'>a</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='string val'>''</span>
385
+ <span class='b identifier id'>b</span> <span class='assign token'>=</span> <span class='TableFu constant id'>TableFu</span><span class='colon2 op'>::</span><span class='Formatting constant id'>Formatting</span><span class='dot token'>.</span><span class='send identifier id'>send</span><span class='lparen token'>(</span><span class='format identifier id'>format</span><span class='comma token'>,</span> <span class='b identifier id'>b</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='string val'>''</span>
386
+ <span class='end end kw'>end</span>
387
+ <span class='result identifier id'>result</span> <span class='assign token'>=</span> <span class='a identifier id'>a</span> <span class='cmp op'>&lt;=&gt;</span> <span class='b identifier id'>b</span>
388
+ <span class='result identifier id'>result</span> <span class='assign token'>=</span> <span class='integer val'>-1</span> <span class='if if_mod kw'>if</span> <span class='result identifier id'>result</span><span class='dot token'>.</span><span class='nil? fid id'>nil?</span>
389
+ <span class='result identifier id'>result</span> <span class='assign token'>=</span> <span class='result identifier id'>result</span> <span class='mult op'>*</span> <span class='integer val'>-1</span> <span class='if if_mod kw'>if</span> <span class='order identifier id'>order</span> <span class='eq op'>==</span> <span class='string val'>'descending'</span>
390
+ <span class='result identifier id'>result</span>
391
+ <span class='else else kw'>else</span>
392
+ <span class='integer val'>-1</span>
393
+ <span class='end end kw'>end</span>
394
+ <span class='end end kw'>end</span>
395
+ </pre>
396
+ </td>
397
+ </tr>
398
+ </table>
399
+ </div>
400
+
401
+ <div class="method_details ">
402
+ <p class="signature " id="columns-instance_method">
403
+
404
+ - (<tt>Object</tt>) <strong>columns</strong>
405
+
406
+
407
+
408
+ </p><table class="source_code">
409
+ <tr>
410
+ <td>
411
+ <pre class="lines">
412
+
413
+
414
+ 187
415
+ 188
416
+ 189
417
+ 190
418
+ 191
419
+ 192
420
+ 193</pre>
421
+ </td>
422
+ <td>
423
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 187</span>
424
+
425
+ <span class='def def kw'>def</span> <span class='columns identifier id'>columns</span>
426
+ <span class='all_cols identifier id'>all_cols</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
427
+ <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><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='column identifier id'>column</span><span class='bitor op'>|</span>
428
+ <span class='all_cols identifier id'>all_cols</span> <span class='lshft op'>&lt;&lt;</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>
429
+ <span class='end end kw'>end</span>
430
+ <span class='all_cols identifier id'>all_cols</span>
431
+ <span class='end end kw'>end</span>
432
+ </pre>
433
+ </td>
434
+ </tr>
435
+ </table>
436
+ </div>
437
+
438
+ <div class="method_details ">
439
+ <p class="signature " id="datum_for-instance_method">
440
+
441
+ - (<tt>Object</tt>) <strong>datum_for</strong>(col_name)
442
+
443
+
444
+
445
+ <span class="aliases">Also known as:
446
+ <span class="names"><span id='column_for-instance_method'>column_for</span></span>
447
+ </span>
448
+
449
+ </p><div class="docstring">
450
+ <div class="discussion">
451
+ <p>
452
+ This returns a Datum object for a header name. Will return a nil Datum
453
+ object for nonexistant column names
454
+ </p>
455
+ <p>
456
+ Parameters: header name
457
+ </p>
458
+ <p>
459
+ Returns: Datum object
460
+ </p>
461
+
462
+
463
+ </div>
464
+ </div>
465
+ <div class="tags">
466
+
467
+ </div><table class="source_code">
468
+ <tr>
469
+ <td>
470
+ <pre class="lines">
471
+
472
+
473
+ 204
474
+ 205
475
+ 206
476
+ 207
477
+ 208
478
+ 209
479
+ 210</pre>
480
+ </td>
481
+ <td>
482
+ <pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 204</span>
483
+
484
+ <span class='def def kw'>def</span> <span class='datum_for identifier id'>datum_for</span><span class='lparen token'>(</span><span class='col_name identifier id'>col_name</span><span class='rparen token'>)</span>
485
+ <span class='if if kw'>if</span> <span class='col_num identifier id'>col_num</span> <span class='assign token'>=</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='column_headers identifier id'>column_headers</span><span class='dot token'>.</span><span class='index identifier id'>index</span><span class='lparen token'>(</span><span class='col_name identifier id'>col_name</span><span class='rparen token'>)</span>
486
+ <span class='TableFu constant id'>TableFu</span><span class='colon2 op'>::</span><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='self self kw'>self</span><span class='lbrack token'>[</span><span class='col_num identifier id'>col_num</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='col_name identifier id'>col_name</span><span class='comma token'>,</span> <span class='@row_num ivar id'>@row_num</span><span class='comma token'>,</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='rparen token'>)</span>
487
+ <span class='else else kw'>else</span> <span class='comment val'># Return a nil Datum object for non existant column names</span>
488
+ <span class='TableFu constant id'>TableFu</span><span class='colon2 op'>::</span><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='nil nil kw'>nil</span><span class='comma token'>,</span> <span class='col_name identifier id'>col_name</span><span class='comma token'>,</span> <span class='@row_num ivar id'>@row_num</span><span class='comma token'>,</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='rparen token'>)</span>
489
+ <span class='end end kw'>end</span>
490
+ <span class='end end kw'>end</span>
491
+ </pre>
492
+ </td>
493
+ </tr>
494
+ </table>
495
+ </div>
496
+
497
+ </div>
498
+
499
+ </div>
500
+
501
+ <div id="footer">
502
+ Generated on Tue Mar 9 17:16:37 2010 by
503
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
504
+ 0.5.3 (ruby-1.8.7).
505
+ </div>
506
+
507
+ </body>
508
+ </html>