table_fu 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/LICENSE +20 -0
- data/README +37 -0
- data/Rakefile +58 -0
- data/VERSION.yml +5 -0
- data/doc/TableFu/Datum.html +743 -0
- data/doc/TableFu/Formatting.html +469 -0
- data/doc/TableFu/Header.html +198 -0
- data/doc/TableFu/Row.html +508 -0
- data/doc/TableFu.html +1806 -0
- data/doc/_index.html +154 -0
- data/doc/class_list.html +36 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +50 -0
- data/doc/css/style.css +268 -0
- data/doc/file.README.html +89 -0
- data/doc/file_list.html +38 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +89 -0
- data/doc/js/app.js +99 -0
- data/doc/js/full_list.js +106 -0
- data/doc/js/jquery.js +19 -0
- data/doc/method_list.html +363 -0
- data/doc/top-level-namespace.html +85 -0
- data/documentation/css/dawn.css +121 -0
- data/documentation/css/styles.css +63 -0
- data/documentation/images/proplogo.png +0 -0
- data/documentation/index.html.erb +148 -0
- data/examples/columns.rb +7 -0
- data/examples/columns_hidden.rb +5 -0
- data/examples/faceting.rb +2 -0
- data/examples/formatting_options.rb +6 -0
- data/examples/last_name.rb +4 -0
- data/examples/link.rb +11 -0
- data/examples/only.rb +6 -0
- data/examples/rails_helpers.rb +3 -0
- data/examples/sort_by_column.rb +11 -0
- data/examples/sort_by_number.rb +0 -0
- data/examples/totals.rb +2 -0
- data/examples/zap_joyce.rb +3 -0
- data/index.html +210 -0
- data/lib/table_fu/formatting.rb +52 -0
- data/lib/table_fu.rb +386 -0
- data/spec/assets/sample.csv +476 -0
- data/spec/assets/test.csv +8 -0
- data/spec/assets/test_macro.csv +8 -0
- data/spec/rcov.opts +2 -0
- data/spec/readme_example_spec.rb +39 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/table_fu_spec.rb +221 -0
- data/table_fu.gemspec +112 -0
- metadata +141 -0
@@ -0,0 +1,743 @@
|
|
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::Datum</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 (D)</a> »
|
27
|
+
<span class='title'><a href="../TableFu.html" title="TableFu (class)">TableFu</a></span>
|
28
|
+
»
|
29
|
+
<span class="title">Datum</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::Datum
|
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::Datum</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</dd>
|
76
|
+
|
77
|
+
</dl>
|
78
|
+
<div class="clear"></div>
|
79
|
+
|
80
|
+
<h2>Overview</h2><div class="docstring">
|
81
|
+
<div class="discussion">
|
82
|
+
<p>
|
83
|
+
A Datum is an individual cell in the TableFu::Row
|
84
|
+
</p>
|
85
|
+
|
86
|
+
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
<div class="tags">
|
90
|
+
|
91
|
+
</div><div id="subclasses">
|
92
|
+
<h2>Direct Known Subclasses</h2>
|
93
|
+
<p class="children"><a href="Header.html" title="TableFu::Header (class)">Header</a></p>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<h2>Instance Attribute Summary</h2>
|
98
|
+
<ul class="summary">
|
99
|
+
|
100
|
+
<li class="public ">
|
101
|
+
<span class="summary_signature">
|
102
|
+
|
103
|
+
<a href="#column_name-instance_method" title="#column_name (instance method)">- (Object) <strong>column_name</strong> </a>
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
</span>
|
108
|
+
|
109
|
+
|
110
|
+
<span class="note title readonly">readonly</span>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<span class="summary_desc">
|
119
|
+
Returns the value of attribute column_name.
|
120
|
+
|
121
|
+
</span>
|
122
|
+
|
123
|
+
</li>
|
124
|
+
|
125
|
+
|
126
|
+
<li class="public ">
|
127
|
+
<span class="summary_signature">
|
128
|
+
|
129
|
+
<a href="#options-instance_method" title="#options (instance method)">- (Object) <strong>options</strong> </a>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
</span>
|
134
|
+
|
135
|
+
|
136
|
+
<span class="note title readonly">readonly</span>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="summary_desc">
|
145
|
+
Returns the value of attribute options.
|
146
|
+
|
147
|
+
</span>
|
148
|
+
|
149
|
+
</li>
|
150
|
+
|
151
|
+
|
152
|
+
</ul>
|
153
|
+
|
154
|
+
|
155
|
+
<h2>Instance Method Summary</h2>
|
156
|
+
|
157
|
+
<ul class="summary">
|
158
|
+
|
159
|
+
<li class="public ">
|
160
|
+
<span class="summary_signature">
|
161
|
+
|
162
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Datum) <strong>initialize</strong>(datum, col_name, row_num, spreadsheet) </a>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</span>
|
167
|
+
|
168
|
+
<span class="note title constructor">constructor</span>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
<span class="summary_desc">
|
177
|
+
Each piece of datum should know where it is by column and row number, along
|
178
|
+
with the spreadsheet it’s apart of.
|
179
|
+
|
180
|
+
</span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#macro_value-instance_method" title="#macro_value (instance method)">- (Object) <strong>macro_value</strong> </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
<span class="summary_desc">
|
201
|
+
Returns the macro’d format if there is one .
|
202
|
+
|
203
|
+
</span>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
|
208
|
+
<li class="public ">
|
209
|
+
<span class="summary_signature">
|
210
|
+
|
211
|
+
<a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(method) </a>
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
</span>
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
<span class="summary_desc">
|
224
|
+
This method missing looks for 4 matches.
|
225
|
+
|
226
|
+
</span>
|
227
|
+
|
228
|
+
</li>
|
229
|
+
|
230
|
+
|
231
|
+
<li class="public ">
|
232
|
+
<span class="summary_signature">
|
233
|
+
|
234
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">- (Object) <strong>to_s</strong> </a>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
</span>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
<span class="summary_desc">
|
247
|
+
Our standard formatter for the datum.
|
248
|
+
|
249
|
+
</span>
|
250
|
+
|
251
|
+
</li>
|
252
|
+
|
253
|
+
|
254
|
+
<li class="public ">
|
255
|
+
<span class="summary_signature">
|
256
|
+
|
257
|
+
<a href="#value-instance_method" title="#value (instance method)">- (Object) <strong>value</strong> </a>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
</span>
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
<span class="summary_desc">
|
270
|
+
Returns the raw value of a datum .
|
271
|
+
|
272
|
+
</span>
|
273
|
+
|
274
|
+
</li>
|
275
|
+
|
276
|
+
|
277
|
+
</ul>
|
278
|
+
<div id="constructor_details" class="method_details_list">
|
279
|
+
<h2>Constructor Details</h2>
|
280
|
+
|
281
|
+
<div class="method_details first">
|
282
|
+
<p class="signature first" id="initialize-instance_method">
|
283
|
+
|
284
|
+
- (<tt><a href="" title="TableFu::Datum (class)">Datum</a></tt>) <strong>initialize</strong>(datum, col_name, row_num, spreadsheet)
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
</p><div class="docstring">
|
289
|
+
<div class="discussion">
|
290
|
+
<p>
|
291
|
+
Each piece of datum should know where it is by column and row number, along
|
292
|
+
with the spreadsheet it’s apart of. There’s probably a better
|
293
|
+
way to go about doing this. Subclass?
|
294
|
+
</p>
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
<div class="tags">
|
300
|
+
|
301
|
+
</div><table class="source_code">
|
302
|
+
<tr>
|
303
|
+
<td>
|
304
|
+
<pre class="lines">
|
305
|
+
|
306
|
+
|
307
|
+
244
|
308
|
+
245
|
309
|
+
246
|
310
|
+
247
|
311
|
+
248
|
312
|
+
249</pre>
|
313
|
+
</td>
|
314
|
+
<td>
|
315
|
+
<pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 244</span>
|
316
|
+
|
317
|
+
<span class='def def kw'>def</span> <span class='initialize identifier id'>initialize</span><span class='lparen token'>(</span><span class='datum identifier id'>datum</span><span class='comma token'>,</span> <span class='col_name identifier id'>col_name</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>
|
318
|
+
<span class='@datum ivar id'>@datum</span> <span class='assign token'>=</span> <span class='datum identifier id'>datum</span>
|
319
|
+
<span class='@column_name ivar id'>@column_name</span> <span class='assign token'>=</span> <span class='col_name identifier id'>col_name</span>
|
320
|
+
<span class='@row_num ivar id'>@row_num</span> <span class='assign token'>=</span> <span class='row_num identifier id'>row_num</span>
|
321
|
+
<span class='@spreadsheet ivar id'>@spreadsheet</span> <span class='assign token'>=</span> <span class='spreadsheet identifier id'>spreadsheet</span>
|
322
|
+
<span class='end end kw'>end</span>
|
323
|
+
</pre>
|
324
|
+
</td>
|
325
|
+
</tr>
|
326
|
+
</table>
|
327
|
+
</div>
|
328
|
+
|
329
|
+
</div>
|
330
|
+
<div id="method_missing_details" class="method_details_list">
|
331
|
+
<h2>Dynamic Method Handling</h2>
|
332
|
+
<p class="notice this">
|
333
|
+
This class handles dynamic methods through the <tt>method_missing</tt> method
|
334
|
+
|
335
|
+
</p>
|
336
|
+
|
337
|
+
<div class="method_details first">
|
338
|
+
<p class="signature first" id="method_missing-instance_method">
|
339
|
+
|
340
|
+
- (<tt>Object</tt>) <strong>method_missing</strong>(method)
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
</p><div class="docstring">
|
345
|
+
<div class="discussion">
|
346
|
+
<p>
|
347
|
+
This method missing looks for 4 matches
|
348
|
+
</p>
|
349
|
+
<p>
|
350
|
+
First Option We have a column option by that method name and it applies to
|
351
|
+
this column Example -
|
352
|
+
</p>
|
353
|
+
<pre class="code">
|
354
|
+
<span class='rshft op'>>></span> <span class='@data ivar id'>@data</span><span class='dot token'>.</span><span class='column_name identifier id'>column_name</span>
|
355
|
+
<span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>'Total'</span>
|
356
|
+
<span class='rshft op'>>></span> <span class='@datum ivar id'>@datum</span><span class='dot token'>.</span><span class='style identifier id'>style</span>
|
357
|
+
</pre>
|
358
|
+
<p>
|
359
|
+
Finds col_opt[:style] = {‘Total’ =>
|
360
|
+
‘text-align:left;’}
|
361
|
+
</p>
|
362
|
+
<pre class="code">
|
363
|
+
<span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>'text-align:left;'</span>
|
364
|
+
</pre>
|
365
|
+
<p>
|
366
|
+
Second Option We have a column option by that method name, but no attribute
|
367
|
+
</p>
|
368
|
+
<pre class="code">
|
369
|
+
<span class='rshft op'>>></span> <span class='@data ivar id'>@data</span><span class='dot token'>.</span><span class='column_name identifier id'>column_name</span>
|
370
|
+
<span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>'Total'</span>
|
371
|
+
<span class='rshft op'>>></span> <span class='@datum ivar id'>@datum</span><span class='dot token'>.</span><span class='style identifier id'>style</span>
|
372
|
+
<span class='Finds constant id'>Finds</span> <span class='col_opt identifier id'>col_opt</span><span class='lbrack token'>[</span><span class='symbol val'>:style</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='lbrace token'>{</span><span class='string val'>'State'</span> <span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>'text-align:left;'</span><span class='rbrace token'>}</span>
|
373
|
+
<span class='assign token'>=</span><span class='gt op'>></span> <span class='string val'>''</span>
|
374
|
+
</pre>
|
375
|
+
<p>
|
376
|
+
Third Option The boolean
|
377
|
+
</p>
|
378
|
+
<pre class="code">
|
379
|
+
<span class='rshft op'>>></span> <span class='@data ivar id'>@data</span><span class='dot token'>.</span><span class='invisible? fid id'>invisible?</span>
|
380
|
+
</pre>
|
381
|
+
<p>
|
382
|
+
And we’ve set it col_opts[:invisible] = [‘Total’]
|
383
|
+
</p>
|
384
|
+
<pre class="code">
|
385
|
+
<span class='assign token'>=</span><span class='gt op'>></span> <span class='true true kw'>true</span>
|
386
|
+
</pre>
|
387
|
+
<p>
|
388
|
+
Fourth Option The boolean that’s false
|
389
|
+
</p>
|
390
|
+
<pre class="code">
|
391
|
+
<span class='rshft op'>>></span> <span class='@data ivar id'>@data</span><span class='dot token'>.</span><span class='invisible? fid id'>invisible?</span>
|
392
|
+
</pre>
|
393
|
+
<p>
|
394
|
+
And it’s not in the list col_opts[:invisible] = [‘State’]
|
395
|
+
</p>
|
396
|
+
<pre class="code">
|
397
|
+
<span class='assign token'>=</span><span class='gt op'>></span> <span class='false false kw'>false</span>
|
398
|
+
</pre>
|
399
|
+
|
400
|
+
|
401
|
+
</div>
|
402
|
+
</div>
|
403
|
+
<div class="tags">
|
404
|
+
|
405
|
+
</div><table class="source_code">
|
406
|
+
<tr>
|
407
|
+
<td>
|
408
|
+
<pre class="lines">
|
409
|
+
|
410
|
+
|
411
|
+
337
|
412
|
+
338
|
413
|
+
339
|
414
|
+
340
|
415
|
+
341
|
416
|
+
342
|
417
|
+
343
|
418
|
+
344
|
419
|
+
345
|
420
|
+
346
|
421
|
+
347
|
422
|
+
348
|
423
|
+
349
|
424
|
+
350</pre>
|
425
|
+
</td>
|
426
|
+
<td>
|
427
|
+
<pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 337</span>
|
428
|
+
|
429
|
+
<span class='def def kw'>def</span> <span class='method_missing identifier id'>method_missing</span><span class='lparen token'>(</span><span class='method identifier id'>method</span><span class='rparen token'>)</span>
|
430
|
+
<span class='opts identifier id'>opts</span> <span class='assign token'>=</span> <span class='indifferent_access identifier id'>indifferent_access</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='col_opts identifier id'>col_opts</span>
|
431
|
+
<span class='if if kw'>if</span> <span class='val identifier id'>val</span> <span class='assign token'>=</span> <span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='method identifier id'>method</span><span class='rbrack token'>]</span> <span class='andop op'>&&</span> <span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='method identifier id'>method</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='column_name identifier id'>column_name</span><span class='rbrack token'>]</span>
|
432
|
+
<span class='val identifier id'>val</span>
|
433
|
+
<span class='elsif elsif kw'>elsif</span> <span class='val identifier id'>val</span> <span class='assign token'>=</span> <span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='method identifier id'>method</span><span class='rbrack token'>]</span> <span class='andop op'>&&</span> <span class='notop op'>!</span><span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='method identifier id'>method</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='column_name identifier id'>column_name</span><span class='rbrack token'>]</span>
|
434
|
+
<span class='string val'>''</span>
|
435
|
+
<span class='elsif elsif kw'>elsif</span> <span class='method identifier id'>method</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> <span class='match op'>=~</span> <span class='regexp val'>/\?$/</span> <span class='andop op'>&&</span> <span class='col_opts identifier id'>col_opts</span> <span class='assign token'>=</span> <span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='method identifier id'>method</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='chop identifier id'>chop</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span><span class='rbrack token'>]</span>
|
436
|
+
<span class='col_opts identifier id'>col_opts</span><span class='dot token'>.</span><span class='index identifier id'>index</span><span class='lparen token'>(</span><span class='column_name identifier id'>column_name</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='false false kw'>false</span>
|
437
|
+
<span class='elsif elsif kw'>elsif</span> <span class='method identifier id'>method</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span> <span class='match op'>=~</span> <span class='regexp val'>/\?$/</span> <span class='andop op'>&&</span> <span class='notop op'>!</span><span class='opts identifier id'>opts</span><span class='lbrack token'>[</span><span class='method identifier id'>method</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='chop identifier id'>chop</span><span class='dot token'>.</span><span class='to_sym identifier id'>to_sym</span><span class='rbrack token'>]</span>
|
438
|
+
<span class='nil nil kw'>nil</span>
|
439
|
+
<span class='else else kw'>else</span>
|
440
|
+
<span class='super super kw'>super</span>
|
441
|
+
<span class='end end kw'>end</span>
|
442
|
+
<span class='end end kw'>end</span>
|
443
|
+
</pre>
|
444
|
+
</td>
|
445
|
+
</tr>
|
446
|
+
</table>
|
447
|
+
</div>
|
448
|
+
|
449
|
+
</div>
|
450
|
+
|
451
|
+
<div id="instance_attr_details" class="attr_details">
|
452
|
+
<h2>Instance Attribute Details</h2>
|
453
|
+
|
454
|
+
|
455
|
+
<span id=""></span>
|
456
|
+
<span id="column_name-instance_method"></span>
|
457
|
+
<div class="method_details first">
|
458
|
+
<p class="signature first" id="column_name-instance_method">
|
459
|
+
|
460
|
+
- (<tt>Object</tt>) <strong>column_name</strong> <span class="extras">(readonly)</span>
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
</p><div class="docstring">
|
465
|
+
<div class="discussion">
|
466
|
+
<p>
|
467
|
+
Returns the value of attribute column_name
|
468
|
+
</p>
|
469
|
+
|
470
|
+
|
471
|
+
</div>
|
472
|
+
</div>
|
473
|
+
<div class="tags">
|
474
|
+
|
475
|
+
</div><table class="source_code">
|
476
|
+
<tr>
|
477
|
+
<td>
|
478
|
+
<pre class="lines">
|
479
|
+
|
480
|
+
|
481
|
+
239
|
482
|
+
240
|
483
|
+
241</pre>
|
484
|
+
</td>
|
485
|
+
<td>
|
486
|
+
<pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 239</span>
|
487
|
+
|
488
|
+
<span class='def def kw'>def</span> <span class='column_name identifier id'>column_name</span>
|
489
|
+
<span class='@column_name ivar id'>@column_name</span>
|
490
|
+
<span class='end end kw'>end</span>
|
491
|
+
</pre>
|
492
|
+
</td>
|
493
|
+
</tr>
|
494
|
+
</table>
|
495
|
+
</div>
|
496
|
+
|
497
|
+
|
498
|
+
<span id=""></span>
|
499
|
+
<span id="options-instance_method"></span>
|
500
|
+
<div class="method_details ">
|
501
|
+
<p class="signature " id="options-instance_method">
|
502
|
+
|
503
|
+
- (<tt>Object</tt>) <strong>options</strong> <span class="extras">(readonly)</span>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
</p><div class="docstring">
|
508
|
+
<div class="discussion">
|
509
|
+
<p>
|
510
|
+
Returns the value of attribute options
|
511
|
+
</p>
|
512
|
+
|
513
|
+
|
514
|
+
</div>
|
515
|
+
</div>
|
516
|
+
<div class="tags">
|
517
|
+
|
518
|
+
</div><table class="source_code">
|
519
|
+
<tr>
|
520
|
+
<td>
|
521
|
+
<pre class="lines">
|
522
|
+
|
523
|
+
|
524
|
+
239
|
525
|
+
240
|
526
|
+
241</pre>
|
527
|
+
</td>
|
528
|
+
<td>
|
529
|
+
<pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 239</span>
|
530
|
+
|
531
|
+
<span class='def def kw'>def</span> <span class='options identifier id'>options</span>
|
532
|
+
<span class='@options ivar id'>@options</span>
|
533
|
+
<span class='end end kw'>end</span>
|
534
|
+
</pre>
|
535
|
+
</td>
|
536
|
+
</tr>
|
537
|
+
</table>
|
538
|
+
</div>
|
539
|
+
|
540
|
+
</div>
|
541
|
+
|
542
|
+
|
543
|
+
<div id="instance_method_details" class="method_details_list">
|
544
|
+
<h2>Instance Method Details</h2>
|
545
|
+
|
546
|
+
|
547
|
+
<div class="method_details first">
|
548
|
+
<p class="signature first" id="macro_value-instance_method">
|
549
|
+
|
550
|
+
- (<tt>Object</tt>) <strong>macro_value</strong>
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
</p><div class="docstring">
|
555
|
+
<div class="discussion">
|
556
|
+
<p>
|
557
|
+
Returns the macro’d format if there is one
|
558
|
+
</p>
|
559
|
+
<p>
|
560
|
+
Returns: The macro value if it exists, otherwise nil
|
561
|
+
</p>
|
562
|
+
|
563
|
+
|
564
|
+
</div>
|
565
|
+
</div>
|
566
|
+
<div class="tags">
|
567
|
+
|
568
|
+
</div><table class="source_code">
|
569
|
+
<tr>
|
570
|
+
<td>
|
571
|
+
<pre class="lines">
|
572
|
+
|
573
|
+
|
574
|
+
277
|
575
|
+
278
|
576
|
+
279
|
577
|
+
280
|
578
|
+
281
|
579
|
+
282
|
580
|
+
283
|
581
|
+
284
|
582
|
+
285
|
583
|
+
286
|
584
|
+
287
|
585
|
+
288
|
586
|
+
289
|
587
|
+
290
|
588
|
+
291
|
589
|
+
292</pre>
|
590
|
+
</td>
|
591
|
+
<td>
|
592
|
+
<pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 277</span>
|
593
|
+
|
594
|
+
<span class='def def kw'>def</span> <span class='macro_value identifier id'>macro_value</span>
|
595
|
+
<span class='comment val'># Grab the macro method first</span>
|
596
|
+
<span class='comment val'># Then get a array of the values in the columns listed as arguments</span>
|
597
|
+
<span class='comment val'># Splat the arguments to the macro method.</span>
|
598
|
+
<span class='comment val'># Example:</span>
|
599
|
+
<span class='comment val'># @spreadsheet.col_opts[:formatting] = </span>
|
600
|
+
<span class='comment val'># {'Total Appropriation' => :currency,</span>
|
601
|
+
<span class='comment val'># 'AppendedColumn' => {'method' => 'append', 'arguments' => ['Projects','State']}}</span>
|
602
|
+
<span class='comment val'># </span>
|
603
|
+
<span class='comment val'># in the above case we handle the AppendedColumn in this method</span>
|
604
|
+
<span class='if if kw'>if</span> <span class='@row_num ivar id'>@row_num</span> <span class='andop op'>&&</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='formatting identifier id'>formatting</span> <span class='andop op'>&&</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='formatting identifier id'>formatting</span><span class='lbrack token'>[</span><span class='@column_name ivar id'>@column_name</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='is_a? fid id'>is_a?</span><span class='lparen token'>(</span><span class='Hash constant id'>Hash</span><span class='rparen token'>)</span>
|
605
|
+
<span class='method identifier id'>method</span> <span class='assign token'>=</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='formatting identifier id'>formatting</span><span class='lbrack token'>[</span><span class='@column_name ivar id'>@column_name</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='string val'>'method'</span><span class='rbrack token'>]</span>
|
606
|
+
<span class='arguments identifier id'>arguments</span> <span class='assign token'>=</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='formatting identifier id'>formatting</span><span class='lbrack token'>[</span><span class='@column_name ivar id'>@column_name</span><span class='rbrack token'>]</span><span class='lbrack token'>[</span><span class='string val'>'arguments'</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='inject identifier id'>inject</span><span class='lparen token'>(</span><span class='lbrack token'>[</span><span class='rbrack token'>]</span><span class='rparen token'>)</span><span class='lbrace token'>{</span><span class='bitor op'>|</span><span class='arr identifier id'>arr</span><span class='comma token'>,</span><span class='arg identifier id'>arg</span><span class='bitor op'>|</span> <span class='arr identifier id'>arr</span> <span class='lshft op'><<</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='rows identifier id'>rows</span><span class='lbrack token'>[</span><span class='@row_num ivar id'>@row_num</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='column_for identifier id'>column_for</span><span class='lparen token'>(</span><span class='arg identifier id'>arg</span><span class='rparen token'>)</span><span class='semicolon token'>;</span> <span class='arr identifier id'>arr</span><span class='rbrace token'>}</span>
|
607
|
+
<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='method identifier id'>method</span><span class='comma token'>,</span> <span class='mult op'>*</span><span class='arguments identifier id'>arguments</span><span class='rparen token'>)</span>
|
608
|
+
<span class='end end kw'>end</span>
|
609
|
+
<span class='end end kw'>end</span>
|
610
|
+
</pre>
|
611
|
+
</td>
|
612
|
+
</tr>
|
613
|
+
</table>
|
614
|
+
</div>
|
615
|
+
|
616
|
+
<div class="method_details ">
|
617
|
+
<p class="signature " id="to_s-instance_method">
|
618
|
+
|
619
|
+
- (<tt>Object</tt>) <strong>to_s</strong>
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
</p><div class="docstring">
|
624
|
+
<div class="discussion">
|
625
|
+
<p>
|
626
|
+
Our standard formatter for the datum
|
627
|
+
</p>
|
628
|
+
<p>
|
629
|
+
Returns: the formatted value, macro value, or a empty string
|
630
|
+
</p>
|
631
|
+
<p>
|
632
|
+
First we test to see if this Datum has a macro attached to it. If so we let
|
633
|
+
the macro method do it’s magic
|
634
|
+
</p>
|
635
|
+
<p>
|
636
|
+
Then we test for a simple formatter method.
|
637
|
+
</p>
|
638
|
+
<p>
|
639
|
+
And finally we return a empty string object or the value.
|
640
|
+
</p>
|
641
|
+
|
642
|
+
|
643
|
+
</div>
|
644
|
+
</div>
|
645
|
+
<div class="tags">
|
646
|
+
|
647
|
+
</div><table class="source_code">
|
648
|
+
<tr>
|
649
|
+
<td>
|
650
|
+
<pre class="lines">
|
651
|
+
|
652
|
+
|
653
|
+
263
|
654
|
+
264
|
655
|
+
265
|
656
|
+
266
|
657
|
+
267
|
658
|
+
268
|
659
|
+
269
|
660
|
+
270
|
661
|
+
271</pre>
|
662
|
+
</td>
|
663
|
+
<td>
|
664
|
+
<pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 263</span>
|
665
|
+
|
666
|
+
<span class='def def kw'>def</span> <span class='to_s identifier id'>to_s</span>
|
667
|
+
<span class='if if kw'>if</span> <span class='macro_value identifier id'>macro_value</span>
|
668
|
+
<span class='macro_value identifier id'>macro_value</span>
|
669
|
+
<span class='elsif elsif kw'>elsif</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='formatting identifier id'>formatting</span> <span class='andop op'>&&</span> <span class='format_method identifier id'>format_method</span> <span class='assign token'>=</span> <span class='@spreadsheet ivar id'>@spreadsheet</span><span class='dot token'>.</span><span class='formatting identifier id'>formatting</span><span class='lbrack token'>[</span><span class='column_name identifier id'>column_name</span><span class='rbrack token'>]</span>
|
670
|
+
<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_method identifier id'>format_method</span><span class='comma token'>,</span> <span class='@datum ivar id'>@datum</span><span class='rparen token'>)</span> <span class='orop op'>||</span> <span class='string val'>''</span>
|
671
|
+
<span class='else else kw'>else</span>
|
672
|
+
<span class='@datum ivar id'>@datum</span> <span class='orop op'>||</span> <span class='string val'>''</span>
|
673
|
+
<span class='end end kw'>end</span>
|
674
|
+
<span class='end end kw'>end</span>
|
675
|
+
</pre>
|
676
|
+
</td>
|
677
|
+
</tr>
|
678
|
+
</table>
|
679
|
+
</div>
|
680
|
+
|
681
|
+
<div class="method_details ">
|
682
|
+
<p class="signature " id="value-instance_method">
|
683
|
+
|
684
|
+
- (<tt>Object</tt>) <strong>value</strong>
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
</p><div class="docstring">
|
689
|
+
<div class="discussion">
|
690
|
+
<p>
|
691
|
+
Returns the raw value of a datum
|
692
|
+
</p>
|
693
|
+
<p>
|
694
|
+
Returns: raw value of the datum, could be nil
|
695
|
+
</p>
|
696
|
+
|
697
|
+
|
698
|
+
</div>
|
699
|
+
</div>
|
700
|
+
<div class="tags">
|
701
|
+
|
702
|
+
</div><table class="source_code">
|
703
|
+
<tr>
|
704
|
+
<td>
|
705
|
+
<pre class="lines">
|
706
|
+
|
707
|
+
|
708
|
+
298
|
709
|
+
299
|
710
|
+
300
|
711
|
+
301
|
712
|
+
302
|
713
|
+
303
|
714
|
+
304</pre>
|
715
|
+
</td>
|
716
|
+
<td>
|
717
|
+
<pre class="code"><span class="info file"># File 'lib/table_fu.rb', line 298</span>
|
718
|
+
|
719
|
+
<span class='def def kw'>def</span> <span class='value identifier id'>value</span>
|
720
|
+
<span class='if if kw'>if</span> <span class='@datum ivar id'>@datum</span> <span class='match op'>=~</span> <span class='regexp val'>/[0-9]+/</span>
|
721
|
+
<span class='@datum ivar id'>@datum</span><span class='dot token'>.</span><span class='to_i identifier id'>to_i</span>
|
722
|
+
<span class='else else kw'>else</span>
|
723
|
+
<span class='@datum ivar id'>@datum</span>
|
724
|
+
<span class='end end kw'>end</span>
|
725
|
+
<span class='end end kw'>end</span>
|
726
|
+
</pre>
|
727
|
+
</td>
|
728
|
+
</tr>
|
729
|
+
</table>
|
730
|
+
</div>
|
731
|
+
|
732
|
+
</div>
|
733
|
+
|
734
|
+
</div>
|
735
|
+
|
736
|
+
<div id="footer">
|
737
|
+
Generated on Tue Mar 9 17:16:37 2010 by
|
738
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool">yard</a>
|
739
|
+
0.5.3 (ruby-1.8.7).
|
740
|
+
</div>
|
741
|
+
|
742
|
+
</body>
|
743
|
+
</html>
|