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