workbook 0.4.13 → 0.4.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/lib/workbook/modules/cell.rb +14 -0
- data/lib/workbook/version.rb +1 -1
- data/test/test_modules_cache.rb +14 -14
- data/test/test_modules_cell.rb +9 -2
- data/test/test_readers_xls_reader.rb +1 -1
- metadata +4 -46
- data/doc/RubyXL/Cell.html +0 -201
- data/doc/RubyXL/Workbook.html +0 -449
- data/doc/RubyXL.html +0 -128
- data/doc/Workbook/Book.html +0 -1852
- data/doc/Workbook/Cell.html +0 -1553
- data/doc/Workbook/Format.html +0 -1168
- data/doc/Workbook/Modules/RawObjectsStorage.html +0 -502
- data/doc/Workbook/Modules/TableDiffSort.html +0 -758
- data/doc/Workbook/Modules/TypeParser.html +0 -1063
- data/doc/Workbook/Modules.html +0 -117
- data/doc/Workbook/NilValue.html +0 -434
- data/doc/Workbook/Readers/CsvReader.html +0 -324
- data/doc/Workbook/Readers/OdsReader.html +0 -1066
- data/doc/Workbook/Readers/TxtReader.html +0 -236
- data/doc/Workbook/Readers/XlsReader.html +0 -378
- data/doc/Workbook/Readers/XlsShared.html +0 -188
- data/doc/Workbook/Readers/XlsxReader.html +0 -302
- data/doc/Workbook/Readers.html +0 -117
- data/doc/Workbook/Row.html +0 -2392
- data/doc/Workbook/Sheet.html +0 -875
- data/doc/Workbook/Table.html +0 -1732
- data/doc/Workbook/Template.html +0 -634
- data/doc/Workbook/Writers/CsvTableWriter.html +0 -200
- data/doc/Workbook/Writers/HtmlWriter.html +0 -407
- data/doc/Workbook/Writers/XlsWriter.html +0 -905
- data/doc/Workbook/Writers.html +0 -117
- data/doc/Workbook.html +0 -142
- data/doc/_index.html +0 -381
- data/doc/class_list.html +0 -53
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -338
- data/doc/file.README.html +0 -245
- data/doc/file_list.html +0 -55
- data/doc/frames.html +0 -28
- data/doc/index.html +0 -245
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -173
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1308
- data/doc/top-level-namespace.html +0 -112
- data/test/artifacts/floats_problem.xls +0 -0
data/doc/Workbook/Book.html
DELETED
@@ -1,1852 +0,0 @@
|
|
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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: Workbook::Book
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.5.2
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '../';
|
20
|
-
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="../_index.html">Index (B)</a> »
|
35
|
-
<span class='title'><span class='object_link'><a href="../Workbook.html" title="Workbook (module)">Workbook</a></span></span>
|
36
|
-
»
|
37
|
-
<span class="title">Book</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="../class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="../method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="../file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: Workbook::Book
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName">Array</span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next">Array</li>
|
82
|
-
|
83
|
-
<li class="next">Workbook::Book</li>
|
84
|
-
|
85
|
-
</ul>
|
86
|
-
<a href="#" class="inheritanceTree">show all</a>
|
87
|
-
|
88
|
-
</dd>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<dt class="r2">Includes:</dt>
|
96
|
-
<dd class="r2"><span class='object_link'><a href="Readers/CsvReader.html" title="Workbook::Readers::CsvReader (module)">Readers::CsvReader</a></span>, <span class='object_link'><a href="Readers/OdsReader.html" title="Workbook::Readers::OdsReader (module)">Readers::OdsReader</a></span>, <span class='object_link'><a href="Readers/TxtReader.html" title="Workbook::Readers::TxtReader (module)">Readers::TxtReader</a></span>, <span class='object_link'><a href="Readers/XlsReader.html" title="Workbook::Readers::XlsReader (module)">Readers::XlsReader</a></span>, <span class='object_link'><a href="Readers/XlsShared.html" title="Workbook::Readers::XlsShared (module)">Readers::XlsShared</a></span>, <span class='object_link'><a href="Readers/XlsxReader.html" title="Workbook::Readers::XlsxReader (module)">Readers::XlsxReader</a></span>, <span class='object_link'><a href="Writers/HtmlWriter.html" title="Workbook::Writers::HtmlWriter (module)">Writers::HtmlWriter</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html" title="Workbook::Writers::XlsWriter (module)">Writers::XlsWriter</a></span></dd>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
<dt class="r1 last">Defined in:</dt>
|
103
|
-
<dd class="r1 last">lib/workbook/book.rb</dd>
|
104
|
-
|
105
|
-
</dl>
|
106
|
-
<div class="clear"></div>
|
107
|
-
|
108
|
-
<h2>Overview</h2><div class="docstring">
|
109
|
-
<div class="discussion">
|
110
|
-
|
111
|
-
<p>The Book class is the container of sheets. It can be inialized by either
|
112
|
-
the standard initalizer or the open method. The Book class can also keep a
|
113
|
-
reference to a template class, storing shared formatting options.</p>
|
114
|
-
|
115
|
-
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
<div class="tags">
|
119
|
-
|
120
|
-
|
121
|
-
</div>
|
122
|
-
<h2>Constant Summary</h2>
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
<h2>Constant Summary</h2>
|
128
|
-
|
129
|
-
<h3 class="inherited">Constants included
|
130
|
-
from <span class='object_link'><a href="Readers/XlsShared.html" title="Workbook::Readers::XlsShared (module)">Readers::XlsShared</a></span></h3>
|
131
|
-
<p class="inherited"><span class='object_link'><a href="Readers/XlsShared.html#XLS_COLORS-constant" title="Workbook::Readers::XlsShared::XLS_COLORS (constant)">Readers::XlsShared::XLS_COLORS</a></span></p>
|
132
|
-
|
133
|
-
|
134
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
135
|
-
<ul class="summary">
|
136
|
-
|
137
|
-
<li class="public ">
|
138
|
-
<span class="summary_signature">
|
139
|
-
|
140
|
-
<a href="#template-instance_method" title="#template (instance method)">- (Workbook::Format) <strong>template</strong> </a>
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
</span>
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
<span class="summary_desc"><div class='inline'>
|
158
|
-
<p>Returns the template describing how the document should be/is formatted.</p>
|
159
|
-
</div></span>
|
160
|
-
|
161
|
-
</li>
|
162
|
-
|
163
|
-
|
164
|
-
<li class="public ">
|
165
|
-
<span class="summary_signature">
|
166
|
-
|
167
|
-
<a href="#title-instance_method" title="#title (instance method)">- (String) <strong>title</strong> </a>
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
</span>
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
<span class="summary_desc"><div class='inline'>
|
185
|
-
<p>The title of the workbook.</p>
|
186
|
-
</div></span>
|
187
|
-
|
188
|
-
</li>
|
189
|
-
|
190
|
-
|
191
|
-
</ul>
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
<h2>
|
198
|
-
Class Method Summary
|
199
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
200
|
-
</h2>
|
201
|
-
|
202
|
-
<ul class="summary">
|
203
|
-
|
204
|
-
<li class="public ">
|
205
|
-
<span class="summary_signature">
|
206
|
-
|
207
|
-
<a href="#open-class_method" title="open (class method)">+ (Workbook::Book) <strong>open</strong>(filename, extension = nil) </a>
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
</span>
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
<span class="summary_desc"><div class='inline'>
|
222
|
-
<p>Create an instance from a file, using open.</p>
|
223
|
-
</div></span>
|
224
|
-
|
225
|
-
</li>
|
226
|
-
|
227
|
-
|
228
|
-
<li class="public ">
|
229
|
-
<span class="summary_signature">
|
230
|
-
|
231
|
-
<a href="#read-class_method" title="read (class method)">+ (Workbook::Book) <strong>read</strong>(stringio_or_string, filetype) </a>
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
</span>
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
<span class="summary_desc"><div class='inline'>
|
246
|
-
<p>Create an instance from the given stream or string, which should be in CSV
|
247
|
-
or TXT format.</p>
|
248
|
-
</div></span>
|
249
|
-
|
250
|
-
</li>
|
251
|
-
|
252
|
-
|
253
|
-
</ul>
|
254
|
-
|
255
|
-
<h2>
|
256
|
-
Instance Method Summary
|
257
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
258
|
-
</h2>
|
259
|
-
|
260
|
-
<ul class="summary">
|
261
|
-
|
262
|
-
<li class="public ">
|
263
|
-
<span class="summary_signature">
|
264
|
-
|
265
|
-
<a href="#create_or_open_sheet_at-instance_method" title="#create_or_open_sheet_at (instance method)">- (Object) <strong>create_or_open_sheet_at</strong>(index) </a>
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
</span>
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
<span class="summary_desc"><div class='inline'>
|
280
|
-
<p>Create or open the existing sheet at an index value.</p>
|
281
|
-
</div></span>
|
282
|
-
|
283
|
-
</li>
|
284
|
-
|
285
|
-
|
286
|
-
<li class="public ">
|
287
|
-
<span class="summary_signature">
|
288
|
-
|
289
|
-
<a href="#file_extension-instance_method" title="#file_extension (instance method)">- (String) <strong>file_extension</strong>(filename) </a>
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
</span>
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
<span class="summary_desc"><div class='inline'>
|
304
|
-
<p>The file extension.</p>
|
305
|
-
</div></span>
|
306
|
-
|
307
|
-
</li>
|
308
|
-
|
309
|
-
|
310
|
-
<li class="public ">
|
311
|
-
<span class="summary_signature">
|
312
|
-
|
313
|
-
<a href="#has_contents%3F-instance_method" title="#has_contents? (instance method)">- (Boolean) <strong>has_contents?</strong> </a>
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
</span>
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
<span class="summary_desc"><div class='inline'>
|
328
|
-
<p>If the first sheet has any contents.</p>
|
329
|
-
</div></span>
|
330
|
-
|
331
|
-
</li>
|
332
|
-
|
333
|
-
|
334
|
-
<li class="public ">
|
335
|
-
<span class="summary_signature">
|
336
|
-
|
337
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Workbook::Book) <strong>initialize</strong>(sheet = Workbook::Sheet.new([], self, options={})) </a>
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
</span>
|
342
|
-
|
343
|
-
|
344
|
-
<span class="note title constructor">constructor</span>
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
<span class="summary_desc"><div class='inline'></div></span>
|
354
|
-
|
355
|
-
</li>
|
356
|
-
|
357
|
-
|
358
|
-
<li class="public ">
|
359
|
-
<span class="summary_signature">
|
360
|
-
|
361
|
-
<a href="#open-instance_method" title="#open (instance method)">- (Workbook::Book) <strong>open</strong>(filename, extension = nil) </a>
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
</span>
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
<span class="summary_desc"><div class='inline'>
|
376
|
-
<p>Loads an external file into an existing worbook.</p>
|
377
|
-
</div></span>
|
378
|
-
|
379
|
-
</li>
|
380
|
-
|
381
|
-
|
382
|
-
<li class="public ">
|
383
|
-
<span class="summary_signature">
|
384
|
-
|
385
|
-
<a href="#open_binary-instance_method" title="#open_binary (instance method)">- (Workbook::Book) <strong>open_binary</strong>(filename, extension = nil) </a>
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
</span>
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
<span class="summary_desc"><div class='inline'>
|
400
|
-
<p>Open the file in binary, read-only mode, do not read it, but pas it throug
|
401
|
-
to the extension determined loaded.</p>
|
402
|
-
</div></span>
|
403
|
-
|
404
|
-
</li>
|
405
|
-
|
406
|
-
|
407
|
-
<li class="public ">
|
408
|
-
<span class="summary_signature">
|
409
|
-
|
410
|
-
<a href="#open_text-instance_method" title="#open_text (instance method)">- (Object) <strong>open_text</strong>(filename, extension = nil) </a>
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
</span>
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
<span class="summary_desc"><div class='inline'>
|
425
|
-
<p>Open the file in non-binary, read-only mode, read it and parse it to UTF-8.</p>
|
426
|
-
</div></span>
|
427
|
-
|
428
|
-
</li>
|
429
|
-
|
430
|
-
|
431
|
-
<li class="public ">
|
432
|
-
<span class="summary_signature">
|
433
|
-
|
434
|
-
<a href="#push-instance_method" title="#push (instance method)">- (Object) <strong>push</strong>(sheet = Workbook::Sheet.new) </a>
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
</span>
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
<span class="summary_desc"><div class='inline'>
|
449
|
-
<p>Push (like in array) a sheet to the workbook (parameter is optional,
|
450
|
-
default is a new sheet).</p>
|
451
|
-
</div></span>
|
452
|
-
|
453
|
-
</li>
|
454
|
-
|
455
|
-
|
456
|
-
<li class="public ">
|
457
|
-
<span class="summary_signature">
|
458
|
-
|
459
|
-
<a href="#read-instance_method" title="#read (instance method)">- (Object) <strong>read</strong>(stringio_or_string, filetype) </a>
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
</span>
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
<span class="summary_desc"><div class='inline'>
|
474
|
-
<p>Load the CSV data contained in the given StringIO or String object.</p>
|
475
|
-
</div></span>
|
476
|
-
|
477
|
-
</li>
|
478
|
-
|
479
|
-
|
480
|
-
<li class="public ">
|
481
|
-
<span class="summary_signature">
|
482
|
-
|
483
|
-
<a href="#sheet-instance_method" title="#sheet (instance method)">- (Workbook::Sheet) <strong>sheet</strong> </a>
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
</span>
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
<span class="summary_desc"><div class='inline'>
|
498
|
-
<p>Sheet returns the first sheet of a workbook, or an empty one.</p>
|
499
|
-
</div></span>
|
500
|
-
|
501
|
-
</li>
|
502
|
-
|
503
|
-
|
504
|
-
<li class="public ">
|
505
|
-
<span class="summary_signature">
|
506
|
-
|
507
|
-
<a href="#text_to_utf8-instance_method" title="#text_to_utf8 (instance method)">- (Object) <strong>text_to_utf8</strong>(text) </a>
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
</span>
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
<span class="summary_desc"><div class='inline'>
|
522
|
-
<p>Helper method to convert text in a file to UTF-8.</p>
|
523
|
-
</div></span>
|
524
|
-
|
525
|
-
</li>
|
526
|
-
|
527
|
-
|
528
|
-
</ul>
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Readers/TxtReader.html" title="Workbook::Readers::TxtReader (module)">Readers::TxtReader</a></span></h3>
|
541
|
-
<p class="inherited"><span class='object_link'><a href="Readers/TxtReader.html#load_txt-instance_method" title="Workbook::Readers::TxtReader#load_txt (method)">#load_txt</a></span>, <span class='object_link'><a href="Readers/TxtReader.html#parse_txt-instance_method" title="Workbook::Readers::TxtReader#parse_txt (method)">#parse_txt</a></span></p>
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Readers/CsvReader.html" title="Workbook::Readers::CsvReader (module)">Readers::CsvReader</a></span></h3>
|
552
|
-
<p class="inherited"><span class='object_link'><a href="Readers/CsvReader.html#csv_lib-instance_method" title="Workbook::Readers::CsvReader#csv_lib (method)">#csv_lib</a></span>, <span class='object_link'><a href="Readers/CsvReader.html#load_csv-instance_method" title="Workbook::Readers::CsvReader#load_csv (method)">#load_csv</a></span>, <span class='object_link'><a href="Readers/CsvReader.html#parse_csv-instance_method" title="Workbook::Readers::CsvReader#parse_csv (method)">#parse_csv</a></span></p>
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Readers/XlsxReader.html" title="Workbook::Readers::XlsxReader (module)">Readers::XlsxReader</a></span></h3>
|
563
|
-
<p class="inherited"><span class='object_link'><a href="Readers/XlsxReader.html#load_xlsx-instance_method" title="Workbook::Readers::XlsxReader#load_xlsx (method)">#load_xlsx</a></span>, <span class='object_link'><a href="Readers/XlsxReader.html#parse_xlsx-instance_method" title="Workbook::Readers::XlsxReader#parse_xlsx (method)">#parse_xlsx</a></span></p>
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Readers/OdsReader.html" title="Workbook::Readers::OdsReader (module)">Readers::OdsReader</a></span></h3>
|
574
|
-
<p class="inherited"><span class='object_link'><a href="Readers/OdsReader.html#get_column_count-instance_method" title="Workbook::Readers::OdsReader#get_column_count (method)">#get_column_count</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#get_repeat-instance_method" title="Workbook::Readers::OdsReader#get_repeat (method)">#get_repeat</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#load_ods-instance_method" title="Workbook::Readers::OdsReader#load_ods (method)">#load_ods</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#parse_local_cell-instance_method" title="Workbook::Readers::OdsReader#parse_local_cell (method)">#parse_local_cell</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#parse_local_row-instance_method" title="Workbook::Readers::OdsReader#parse_local_row (method)">#parse_local_row</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#parse_local_table-instance_method" title="Workbook::Readers::OdsReader#parse_local_table (method)">#parse_local_table</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#parse_local_value-instance_method" title="Workbook::Readers::OdsReader#parse_local_value (method)">#parse_local_value</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#parse_ods-instance_method" title="Workbook::Readers::OdsReader#parse_ods (method)">#parse_ods</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#parse_ods_style-instance_method" title="Workbook::Readers::OdsReader#parse_ods_style (method)">#parse_ods_style</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#set_cell_attributes-instance_method" title="Workbook::Readers::OdsReader#set_cell_attributes (method)">#set_cell_attributes</a></span>, <span class='object_link'><a href="Readers/OdsReader.html#set_format_property-instance_method" title="Workbook::Readers::OdsReader#set_format_property (method)">#set_format_property</a></span></p>
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Readers/XlsReader.html" title="Workbook::Readers::XlsReader (module)">Readers::XlsReader</a></span></h3>
|
585
|
-
<p class="inherited"><span class='object_link'><a href="Readers/XlsReader.html#load_xls-instance_method" title="Workbook::Readers::XlsReader#load_xls (method)">#load_xls</a></span>, <span class='object_link'><a href="Readers/XlsReader.html#parse_xls-instance_method" title="Workbook::Readers::XlsReader#parse_xls (method)">#parse_xls</a></span></p>
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Writers/HtmlWriter.html" title="Workbook::Writers::HtmlWriter (module)">Writers::HtmlWriter</a></span></h3>
|
596
|
-
<p class="inherited"><span class='object_link'><a href="Writers/HtmlWriter.html#to_html-instance_method" title="Workbook::Writers::HtmlWriter#to_html (method)">#to_html</a></span>, <span class='object_link'><a href="Writers/HtmlWriter.html#write_to_html-instance_method" title="Workbook::Writers::HtmlWriter#write_to_html (method)">#write_to_html</a></span></p>
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
<h3 class="inherited">Methods included from <span class='object_link'><a href="Writers/XlsWriter.html" title="Workbook::Writers::XlsWriter (module)">Writers::XlsWriter</a></span></h3>
|
607
|
-
<p class="inherited"><span class='object_link'><a href="Writers/XlsWriter.html#format_to_xls_format-instance_method" title="Workbook::Writers::XlsWriter#format_to_xls_format (method)">#format_to_xls_format</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html#html_color_to_xls_color-instance_method" title="Workbook::Writers::XlsWriter#html_color_to_xls_color (method)">#html_color_to_xls_color</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html#init_spreadsheet_template-instance_method" title="Workbook::Writers::XlsWriter#init_spreadsheet_template (method)">#init_spreadsheet_template</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html#strftime_to_ms_format-instance_method" title="Workbook::Writers::XlsWriter#strftime_to_ms_format (method)">#strftime_to_ms_format</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html#to_xls-instance_method" title="Workbook::Writers::XlsWriter#to_xls (method)">#to_xls</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html#write_to_xls-instance_method" title="Workbook::Writers::XlsWriter#write_to_xls (method)">#write_to_xls</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html#xls_sheet-instance_method" title="Workbook::Writers::XlsWriter#xls_sheet (method)">#xls_sheet</a></span>, <span class='object_link'><a href="Writers/XlsWriter.html#xls_template-instance_method" title="Workbook::Writers::XlsWriter#xls_template (method)">#xls_template</a></span></p>
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
<div id="constructor_details" class="method_details_list">
|
616
|
-
<h2>Constructor Details</h2>
|
617
|
-
|
618
|
-
<div class="method_details first">
|
619
|
-
<h3 class="signature first" id="initialize-instance_method">
|
620
|
-
|
621
|
-
- (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>initialize</strong>(sheet = Workbook::Sheet.new([], self, options={}))
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
</h3><div class="docstring">
|
628
|
-
<div class="discussion">
|
629
|
-
|
630
|
-
|
631
|
-
</div>
|
632
|
-
</div>
|
633
|
-
<div class="tags">
|
634
|
-
<p class="tag_title">Parameters:</p>
|
635
|
-
<ul class="param">
|
636
|
-
|
637
|
-
<li>
|
638
|
-
|
639
|
-
<span class='name'>sheet</span>
|
640
|
-
|
641
|
-
|
642
|
-
<span class='type'>(<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>, <tt>Array</tt>)</span>
|
643
|
-
|
644
|
-
|
645
|
-
<em class="default">(defaults to: <tt>Workbook::Sheet.new([], self, options={})</tt>)</em>
|
646
|
-
|
647
|
-
|
648
|
-
—
|
649
|
-
<div class='inline'>
|
650
|
-
<p>create a new workbook based on an existing sheet, or initialize a sheet
|
651
|
-
based on the array</p>
|
652
|
-
</div>
|
653
|
-
|
654
|
-
</li>
|
655
|
-
|
656
|
-
</ul>
|
657
|
-
|
658
|
-
|
659
|
-
</div><table class="source_code">
|
660
|
-
<tr>
|
661
|
-
<td>
|
662
|
-
<pre class="lines">
|
663
|
-
|
664
|
-
|
665
|
-
30
|
666
|
-
31
|
667
|
-
32
|
668
|
-
33
|
669
|
-
34
|
670
|
-
35
|
671
|
-
36</pre>
|
672
|
-
</td>
|
673
|
-
<td>
|
674
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 30</span>
|
675
|
-
|
676
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_sheet'>sheet</span><span class='op'>=</span><span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Sheet</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
677
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_sheet'>sheet</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Sheet</span>
|
678
|
-
<span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_sheet'>sheet</span>
|
679
|
-
<span class='kw'>else</span>
|
680
|
-
<span class='id identifier rubyid_push'>push</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Sheet</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_sheet'>sheet</span><span class='comma'>,</span> <span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
681
|
-
<span class='kw'>end</span>
|
682
|
-
<span class='kw'>end</span></pre>
|
683
|
-
</td>
|
684
|
-
</tr>
|
685
|
-
</table>
|
686
|
-
</div>
|
687
|
-
|
688
|
-
</div>
|
689
|
-
|
690
|
-
<div id="instance_attr_details" class="attr_details">
|
691
|
-
<h2>Instance Attribute Details</h2>
|
692
|
-
|
693
|
-
|
694
|
-
<span id="template=-instance_method"></span>
|
695
|
-
<div class="method_details first">
|
696
|
-
<h3 class="signature first" id="template-instance_method">
|
697
|
-
|
698
|
-
- (<tt><span class='object_link'><a href="Format.html" title="Workbook::Format (class)">Workbook::Format</a></span></tt>) <strong>template</strong>
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
</h3><div class="docstring">
|
705
|
-
<div class="discussion">
|
706
|
-
|
707
|
-
<p>Returns the template describing how the document should be/is formatted</p>
|
708
|
-
|
709
|
-
|
710
|
-
</div>
|
711
|
-
</div>
|
712
|
-
<div class="tags">
|
713
|
-
|
714
|
-
<p class="tag_title">Returns:</p>
|
715
|
-
<ul class="return">
|
716
|
-
|
717
|
-
<li>
|
718
|
-
|
719
|
-
|
720
|
-
<span class='type'>(<tt><span class='object_link'><a href="Format.html" title="Workbook::Format (class)">Workbook::Format</a></span></tt>)</span>
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
—
|
725
|
-
<div class='inline'>
|
726
|
-
<p>returns the template describing how the document should be/is formatted</p>
|
727
|
-
</div>
|
728
|
-
|
729
|
-
</li>
|
730
|
-
|
731
|
-
</ul>
|
732
|
-
|
733
|
-
</div><table class="source_code">
|
734
|
-
<tr>
|
735
|
-
<td>
|
736
|
-
<pre class="lines">
|
737
|
-
|
738
|
-
|
739
|
-
39
|
740
|
-
40
|
741
|
-
41</pre>
|
742
|
-
</td>
|
743
|
-
<td>
|
744
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 39</span>
|
745
|
-
|
746
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_template'>template</span>
|
747
|
-
<span class='ivar'>@template</span>
|
748
|
-
<span class='kw'>end</span></pre>
|
749
|
-
</td>
|
750
|
-
</tr>
|
751
|
-
</table>
|
752
|
-
</div>
|
753
|
-
|
754
|
-
|
755
|
-
<span id="title=-instance_method"></span>
|
756
|
-
<div class="method_details ">
|
757
|
-
<h3 class="signature " id="title-instance_method">
|
758
|
-
|
759
|
-
- (<tt>String</tt>) <strong>title</strong>
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
</h3><div class="docstring">
|
766
|
-
<div class="discussion">
|
767
|
-
|
768
|
-
<p>The title of the workbook</p>
|
769
|
-
|
770
|
-
|
771
|
-
</div>
|
772
|
-
</div>
|
773
|
-
<div class="tags">
|
774
|
-
|
775
|
-
<p class="tag_title">Returns:</p>
|
776
|
-
<ul class="return">
|
777
|
-
|
778
|
-
<li>
|
779
|
-
|
780
|
-
|
781
|
-
<span class='type'>(<tt>String</tt>)</span>
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
—
|
786
|
-
<div class='inline'>
|
787
|
-
<p>the title of the workbook</p>
|
788
|
-
</div>
|
789
|
-
|
790
|
-
</li>
|
791
|
-
|
792
|
-
</ul>
|
793
|
-
|
794
|
-
</div><table class="source_code">
|
795
|
-
<tr>
|
796
|
-
<td>
|
797
|
-
<pre class="lines">
|
798
|
-
|
799
|
-
|
800
|
-
52
|
801
|
-
53
|
802
|
-
54</pre>
|
803
|
-
</td>
|
804
|
-
<td>
|
805
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 52</span>
|
806
|
-
|
807
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_title'>title</span>
|
808
|
-
<span class='ivar'>@title</span>
|
809
|
-
<span class='kw'>end</span></pre>
|
810
|
-
</td>
|
811
|
-
</tr>
|
812
|
-
</table>
|
813
|
-
</div>
|
814
|
-
|
815
|
-
</div>
|
816
|
-
|
817
|
-
|
818
|
-
<div id="class_method_details" class="method_details_list">
|
819
|
-
<h2>Class Method Details</h2>
|
820
|
-
|
821
|
-
|
822
|
-
<div class="method_details first">
|
823
|
-
<h3 class="signature first" id="open-class_method">
|
824
|
-
|
825
|
-
+ (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>open</strong>(filename, extension = nil)
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
</h3><div class="docstring">
|
832
|
-
<div class="discussion">
|
833
|
-
|
834
|
-
<p>Create an instance from a file, using open.</p>
|
835
|
-
|
836
|
-
|
837
|
-
</div>
|
838
|
-
</div>
|
839
|
-
<div class="tags">
|
840
|
-
<p class="tag_title">Parameters:</p>
|
841
|
-
<ul class="param">
|
842
|
-
|
843
|
-
<li>
|
844
|
-
|
845
|
-
<span class='name'>filename</span>
|
846
|
-
|
847
|
-
|
848
|
-
<span class='type'>(<tt>String</tt>)</span>
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
—
|
853
|
-
<div class='inline'>
|
854
|
-
<p>of the document</p>
|
855
|
-
</div>
|
856
|
-
|
857
|
-
</li>
|
858
|
-
|
859
|
-
<li>
|
860
|
-
|
861
|
-
<span class='name'>extension</span>
|
862
|
-
|
863
|
-
|
864
|
-
<span class='type'>(<tt>String</tt>)</span>
|
865
|
-
|
866
|
-
|
867
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
868
|
-
|
869
|
-
|
870
|
-
—
|
871
|
-
<div class='inline'>
|
872
|
-
<p>of the document (not required). The parser used is based on the extension
|
873
|
-
of the file, this option allows you to override the default.</p>
|
874
|
-
</div>
|
875
|
-
|
876
|
-
</li>
|
877
|
-
|
878
|
-
</ul>
|
879
|
-
|
880
|
-
<p class="tag_title">Returns:</p>
|
881
|
-
<ul class="return">
|
882
|
-
|
883
|
-
<li>
|
884
|
-
|
885
|
-
|
886
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>)</span>
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
—
|
891
|
-
<div class='inline'>
|
892
|
-
<p>A new instance, based on the filename</p>
|
893
|
-
</div>
|
894
|
-
|
895
|
-
</li>
|
896
|
-
|
897
|
-
</ul>
|
898
|
-
|
899
|
-
</div><table class="source_code">
|
900
|
-
<tr>
|
901
|
-
<td>
|
902
|
-
<pre class="lines">
|
903
|
-
|
904
|
-
|
905
|
-
150
|
906
|
-
151
|
907
|
-
152
|
908
|
-
153
|
909
|
-
154</pre>
|
910
|
-
</td>
|
911
|
-
<td>
|
912
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 150</span>
|
913
|
-
|
914
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_extension'>extension</span><span class='op'>=</span><span class='kw'>nil</span>
|
915
|
-
<span class='id identifier rubyid_wb'>wb</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
916
|
-
<span class='id identifier rubyid_wb'>wb</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_extension'>extension</span>
|
917
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_wb'>wb</span>
|
918
|
-
<span class='kw'>end</span></pre>
|
919
|
-
</td>
|
920
|
-
</tr>
|
921
|
-
</table>
|
922
|
-
</div>
|
923
|
-
|
924
|
-
<div class="method_details ">
|
925
|
-
<h3 class="signature " id="read-class_method">
|
926
|
-
|
927
|
-
+ (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>read</strong>(stringio_or_string, filetype)
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
</h3><div class="docstring">
|
934
|
-
<div class="discussion">
|
935
|
-
|
936
|
-
<p>Create an instance from the given stream or string, which should be in CSV
|
937
|
-
or TXT format</p>
|
938
|
-
|
939
|
-
|
940
|
-
</div>
|
941
|
-
</div>
|
942
|
-
<div class="tags">
|
943
|
-
<p class="tag_title">Parameters:</p>
|
944
|
-
<ul class="param">
|
945
|
-
|
946
|
-
<li>
|
947
|
-
|
948
|
-
<span class='name'>stringio_or_string</span>
|
949
|
-
|
950
|
-
|
951
|
-
<span class='type'>(<tt>StringIO</tt>)</span>
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
—
|
956
|
-
<div class='inline'>
|
957
|
-
<p>StringIO stream or String object, with data in CSV or TXT format</p>
|
958
|
-
</div>
|
959
|
-
|
960
|
-
</li>
|
961
|
-
|
962
|
-
<li>
|
963
|
-
|
964
|
-
<span class='name'>filetype</span>
|
965
|
-
|
966
|
-
|
967
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
—
|
972
|
-
<div class='inline'>
|
973
|
-
<p>(currently only :csv or :txt), indicating the format of the first parameter</p>
|
974
|
-
</div>
|
975
|
-
|
976
|
-
</li>
|
977
|
-
|
978
|
-
</ul>
|
979
|
-
|
980
|
-
<p class="tag_title">Returns:</p>
|
981
|
-
<ul class="return">
|
982
|
-
|
983
|
-
<li>
|
984
|
-
|
985
|
-
|
986
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>)</span>
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
—
|
991
|
-
<div class='inline'>
|
992
|
-
<p>A new instance</p>
|
993
|
-
</div>
|
994
|
-
|
995
|
-
</li>
|
996
|
-
|
997
|
-
</ul>
|
998
|
-
|
999
|
-
</div><table class="source_code">
|
1000
|
-
<tr>
|
1001
|
-
<td>
|
1002
|
-
<pre class="lines">
|
1003
|
-
|
1004
|
-
|
1005
|
-
161
|
1006
|
-
162
|
1007
|
-
163
|
1008
|
-
164
|
1009
|
-
165</pre>
|
1010
|
-
</td>
|
1011
|
-
<td>
|
1012
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 161</span>
|
1013
|
-
|
1014
|
-
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_stringio_or_string'>stringio_or_string</span><span class='comma'>,</span> <span class='id identifier rubyid_filetype'>filetype</span><span class='rparen'>)</span>
|
1015
|
-
<span class='id identifier rubyid_wb'>wb</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1016
|
-
<span class='id identifier rubyid_wb'>wb</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_stringio_or_string'>stringio_or_string</span><span class='comma'>,</span> <span class='id identifier rubyid_filetype'>filetype</span><span class='rparen'>)</span>
|
1017
|
-
<span class='id identifier rubyid_wb'>wb</span>
|
1018
|
-
<span class='kw'>end</span></pre>
|
1019
|
-
</td>
|
1020
|
-
</tr>
|
1021
|
-
</table>
|
1022
|
-
</div>
|
1023
|
-
|
1024
|
-
</div>
|
1025
|
-
|
1026
|
-
<div id="instance_method_details" class="method_details_list">
|
1027
|
-
<h2>Instance Method Details</h2>
|
1028
|
-
|
1029
|
-
|
1030
|
-
<div class="method_details first">
|
1031
|
-
<h3 class="signature first" id="create_or_open_sheet_at-instance_method">
|
1032
|
-
|
1033
|
-
- (<tt>Object</tt>) <strong>create_or_open_sheet_at</strong>(index)
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
</h3><div class="docstring">
|
1040
|
-
<div class="discussion">
|
1041
|
-
|
1042
|
-
<p>Create or open the existing sheet at an index value</p>
|
1043
|
-
|
1044
|
-
|
1045
|
-
</div>
|
1046
|
-
</div>
|
1047
|
-
<div class="tags">
|
1048
|
-
<p class="tag_title">Parameters:</p>
|
1049
|
-
<ul class="param">
|
1050
|
-
|
1051
|
-
<li>
|
1052
|
-
|
1053
|
-
<span class='name'>index</span>
|
1054
|
-
|
1055
|
-
|
1056
|
-
<span class='type'>(<tt>Integer</tt>)</span>
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
—
|
1061
|
-
<div class='inline'>
|
1062
|
-
<p>the index of the sheet</p>
|
1063
|
-
</div>
|
1064
|
-
|
1065
|
-
</li>
|
1066
|
-
|
1067
|
-
</ul>
|
1068
|
-
|
1069
|
-
|
1070
|
-
</div><table class="source_code">
|
1071
|
-
<tr>
|
1072
|
-
<td>
|
1073
|
-
<pre class="lines">
|
1074
|
-
|
1075
|
-
|
1076
|
-
181
|
1077
|
-
182
|
1078
|
-
183
|
1079
|
-
184
|
1080
|
-
185
|
1081
|
-
186</pre>
|
1082
|
-
</td>
|
1083
|
-
<td>
|
1084
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 181</span>
|
1085
|
-
|
1086
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_create_or_open_sheet_at'>create_or_open_sheet_at</span> <span class='id identifier rubyid_index'>index</span>
|
1087
|
-
<span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span>
|
1088
|
-
<span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='kw'>self</span><span class='lbracket'>[</span><span class='id identifier rubyid_index'>index</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Sheet</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>if</span> <span class='id identifier rubyid_s'>s</span> <span class='op'>==</span> <span class='kw'>nil</span>
|
1089
|
-
<span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_book'>book</span> <span class='op'>=</span> <span class='kw'>self</span>
|
1090
|
-
<span class='id identifier rubyid_s'>s</span>
|
1091
|
-
<span class='kw'>end</span></pre>
|
1092
|
-
</td>
|
1093
|
-
</tr>
|
1094
|
-
</table>
|
1095
|
-
</div>
|
1096
|
-
|
1097
|
-
<div class="method_details ">
|
1098
|
-
<h3 class="signature " id="file_extension-instance_method">
|
1099
|
-
|
1100
|
-
- (<tt>String</tt>) <strong>file_extension</strong>(filename)
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
</h3><div class="docstring">
|
1107
|
-
<div class="discussion">
|
1108
|
-
|
1109
|
-
<p>The file extension</p>
|
1110
|
-
|
1111
|
-
|
1112
|
-
</div>
|
1113
|
-
</div>
|
1114
|
-
<div class="tags">
|
1115
|
-
<p class="tag_title">Parameters:</p>
|
1116
|
-
<ul class="param">
|
1117
|
-
|
1118
|
-
<li>
|
1119
|
-
|
1120
|
-
<span class='name'>filename</span>
|
1121
|
-
|
1122
|
-
|
1123
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
—
|
1128
|
-
<div class='inline'>
|
1129
|
-
<p>The full filename, or path</p>
|
1130
|
-
</div>
|
1131
|
-
|
1132
|
-
</li>
|
1133
|
-
|
1134
|
-
</ul>
|
1135
|
-
|
1136
|
-
<p class="tag_title">Returns:</p>
|
1137
|
-
<ul class="return">
|
1138
|
-
|
1139
|
-
<li>
|
1140
|
-
|
1141
|
-
|
1142
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
—
|
1147
|
-
<div class='inline'>
|
1148
|
-
<p>The file extension</p>
|
1149
|
-
</div>
|
1150
|
-
|
1151
|
-
</li>
|
1152
|
-
|
1153
|
-
</ul>
|
1154
|
-
|
1155
|
-
</div><table class="source_code">
|
1156
|
-
<tr>
|
1157
|
-
<td>
|
1158
|
-
<pre class="lines">
|
1159
|
-
|
1160
|
-
|
1161
|
-
141
|
1162
|
-
142
|
1163
|
-
143</pre>
|
1164
|
-
</td>
|
1165
|
-
<td>
|
1166
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 141</span>
|
1167
|
-
|
1168
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_file_extension'>file_extension</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
1169
|
-
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_extname'>extname</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='kw'>if</span> <span class='id identifier rubyid_filename'>filename</span>
|
1170
|
-
<span class='kw'>end</span></pre>
|
1171
|
-
</td>
|
1172
|
-
</tr>
|
1173
|
-
</table>
|
1174
|
-
</div>
|
1175
|
-
|
1176
|
-
<div class="method_details ">
|
1177
|
-
<h3 class="signature " id="has_contents?-instance_method">
|
1178
|
-
|
1179
|
-
- (<tt>Boolean</tt>) <strong>has_contents?</strong>
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
</h3><div class="docstring">
|
1186
|
-
<div class="discussion">
|
1187
|
-
|
1188
|
-
<p>If the first sheet has any contents</p>
|
1189
|
-
|
1190
|
-
|
1191
|
-
</div>
|
1192
|
-
</div>
|
1193
|
-
<div class="tags">
|
1194
|
-
|
1195
|
-
<p class="tag_title">Returns:</p>
|
1196
|
-
<ul class="return">
|
1197
|
-
|
1198
|
-
<li>
|
1199
|
-
|
1200
|
-
|
1201
|
-
<span class='type'>(<tt>Boolean</tt>)</span>
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
—
|
1206
|
-
<div class='inline'>
|
1207
|
-
<p>returns true if the first sheet has contents</p>
|
1208
|
-
</div>
|
1209
|
-
|
1210
|
-
</li>
|
1211
|
-
|
1212
|
-
</ul>
|
1213
|
-
|
1214
|
-
</div><table class="source_code">
|
1215
|
-
<tr>
|
1216
|
-
<td>
|
1217
|
-
<pre class="lines">
|
1218
|
-
|
1219
|
-
|
1220
|
-
74
|
1221
|
-
75
|
1222
|
-
76</pre>
|
1223
|
-
</td>
|
1224
|
-
<td>
|
1225
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 74</span>
|
1226
|
-
|
1227
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_has_contents?'>has_contents?</span>
|
1228
|
-
<span class='id identifier rubyid_sheet'>sheet</span><span class='period'>.</span><span class='id identifier rubyid_has_contents?'>has_contents?</span>
|
1229
|
-
<span class='kw'>end</span></pre>
|
1230
|
-
</td>
|
1231
|
-
</tr>
|
1232
|
-
</table>
|
1233
|
-
</div>
|
1234
|
-
|
1235
|
-
<div class="method_details ">
|
1236
|
-
<h3 class="signature " id="open-instance_method">
|
1237
|
-
|
1238
|
-
- (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>open</strong>(filename, extension = nil)
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
</h3><div class="docstring">
|
1245
|
-
<div class="discussion">
|
1246
|
-
|
1247
|
-
<p>Loads an external file into an existing worbook</p>
|
1248
|
-
|
1249
|
-
|
1250
|
-
</div>
|
1251
|
-
</div>
|
1252
|
-
<div class="tags">
|
1253
|
-
<p class="tag_title">Parameters:</p>
|
1254
|
-
<ul class="param">
|
1255
|
-
|
1256
|
-
<li>
|
1257
|
-
|
1258
|
-
<span class='name'>filename</span>
|
1259
|
-
|
1260
|
-
|
1261
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
—
|
1266
|
-
<div class='inline'>
|
1267
|
-
<p>a string with a reference to the file to be opened</p>
|
1268
|
-
</div>
|
1269
|
-
|
1270
|
-
</li>
|
1271
|
-
|
1272
|
-
<li>
|
1273
|
-
|
1274
|
-
<span class='name'>extension</span>
|
1275
|
-
|
1276
|
-
|
1277
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1278
|
-
|
1279
|
-
|
1280
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1281
|
-
|
1282
|
-
|
1283
|
-
—
|
1284
|
-
<div class='inline'>
|
1285
|
-
<p>an optional string enforcing a certain parser (based on the file extension,
|
1286
|
-
e.g. ‘txt’, ‘csv’ or ‘xls’)</p>
|
1287
|
-
</div>
|
1288
|
-
|
1289
|
-
</li>
|
1290
|
-
|
1291
|
-
</ul>
|
1292
|
-
|
1293
|
-
<p class="tag_title">Returns:</p>
|
1294
|
-
<ul class="return">
|
1295
|
-
|
1296
|
-
<li>
|
1297
|
-
|
1298
|
-
|
1299
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>)</span>
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
—
|
1304
|
-
<div class='inline'>
|
1305
|
-
<p>A new instance, based on the filename</p>
|
1306
|
-
</div>
|
1307
|
-
|
1308
|
-
</li>
|
1309
|
-
|
1310
|
-
</ul>
|
1311
|
-
|
1312
|
-
</div><table class="source_code">
|
1313
|
-
<tr>
|
1314
|
-
<td>
|
1315
|
-
<pre class="lines">
|
1316
|
-
|
1317
|
-
|
1318
|
-
83
|
1319
|
-
84
|
1320
|
-
85
|
1321
|
-
86
|
1322
|
-
87
|
1323
|
-
88
|
1324
|
-
89
|
1325
|
-
90</pre>
|
1326
|
-
</td>
|
1327
|
-
<td>
|
1328
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 83</span>
|
1329
|
-
|
1330
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_open'>open</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_extension'>extension</span><span class='op'>=</span><span class='kw'>nil</span>
|
1331
|
-
<span class='id identifier rubyid_extension'>extension</span> <span class='op'>=</span> <span class='id identifier rubyid_file_extension'>file_extension</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_extension'>extension</span>
|
1332
|
-
<span class='kw'>if</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>txt</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>csv</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>xml</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_extension'>extension</span><span class='rparen'>)</span>
|
1333
|
-
<span class='id identifier rubyid_open_text'>open_text</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_extension'>extension</span>
|
1334
|
-
<span class='kw'>else</span>
|
1335
|
-
<span class='id identifier rubyid_open_binary'>open_binary</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_extension'>extension</span>
|
1336
|
-
<span class='kw'>end</span>
|
1337
|
-
<span class='kw'>end</span></pre>
|
1338
|
-
</td>
|
1339
|
-
</tr>
|
1340
|
-
</table>
|
1341
|
-
</div>
|
1342
|
-
|
1343
|
-
<div class="method_details ">
|
1344
|
-
<h3 class="signature " id="open_binary-instance_method">
|
1345
|
-
|
1346
|
-
- (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>open_binary</strong>(filename, extension = nil)
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
</h3><div class="docstring">
|
1353
|
-
<div class="discussion">
|
1354
|
-
|
1355
|
-
<p>Open the file in binary, read-only mode, do not read it, but pas it throug
|
1356
|
-
to the extension determined loaded</p>
|
1357
|
-
|
1358
|
-
|
1359
|
-
</div>
|
1360
|
-
</div>
|
1361
|
-
<div class="tags">
|
1362
|
-
<p class="tag_title">Parameters:</p>
|
1363
|
-
<ul class="param">
|
1364
|
-
|
1365
|
-
<li>
|
1366
|
-
|
1367
|
-
<span class='name'>filename</span>
|
1368
|
-
|
1369
|
-
|
1370
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
—
|
1375
|
-
<div class='inline'>
|
1376
|
-
<p>a string with a reference to the file to be opened</p>
|
1377
|
-
</div>
|
1378
|
-
|
1379
|
-
</li>
|
1380
|
-
|
1381
|
-
<li>
|
1382
|
-
|
1383
|
-
<span class='name'>extension</span>
|
1384
|
-
|
1385
|
-
|
1386
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1387
|
-
|
1388
|
-
|
1389
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1390
|
-
|
1391
|
-
|
1392
|
-
—
|
1393
|
-
<div class='inline'>
|
1394
|
-
<p>an optional string enforcing a certain parser (based on the file extension,
|
1395
|
-
e.g. ‘txt’, ‘csv’ or ‘xls’)</p>
|
1396
|
-
</div>
|
1397
|
-
|
1398
|
-
</li>
|
1399
|
-
|
1400
|
-
</ul>
|
1401
|
-
|
1402
|
-
<p class="tag_title">Returns:</p>
|
1403
|
-
<ul class="return">
|
1404
|
-
|
1405
|
-
<li>
|
1406
|
-
|
1407
|
-
|
1408
|
-
<span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>)</span>
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
—
|
1413
|
-
<div class='inline'>
|
1414
|
-
<p>A new instance, based on the filename</p>
|
1415
|
-
</div>
|
1416
|
-
|
1417
|
-
</li>
|
1418
|
-
|
1419
|
-
</ul>
|
1420
|
-
|
1421
|
-
</div><table class="source_code">
|
1422
|
-
<tr>
|
1423
|
-
<td>
|
1424
|
-
<pre class="lines">
|
1425
|
-
|
1426
|
-
|
1427
|
-
97
|
1428
|
-
98
|
1429
|
-
99
|
1430
|
-
100
|
1431
|
-
101</pre>
|
1432
|
-
</td>
|
1433
|
-
<td>
|
1434
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 97</span>
|
1435
|
-
|
1436
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_open_binary'>open_binary</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_extension'>extension</span><span class='op'>=</span><span class='kw'>nil</span>
|
1437
|
-
<span class='id identifier rubyid_extension'>extension</span> <span class='op'>=</span> <span class='id identifier rubyid_file_extension'>file_extension</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_extension'>extension</span>
|
1438
|
-
<span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rb</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1439
|
-
<span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>load_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_extension'>extension</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span><span class='id identifier rubyid_f'>f</span><span class='rparen'>)</span>
|
1440
|
-
<span class='kw'>end</span></pre>
|
1441
|
-
</td>
|
1442
|
-
</tr>
|
1443
|
-
</table>
|
1444
|
-
</div>
|
1445
|
-
|
1446
|
-
<div class="method_details ">
|
1447
|
-
<h3 class="signature " id="open_text-instance_method">
|
1448
|
-
|
1449
|
-
- (<tt>Object</tt>) <strong>open_text</strong>(filename, extension = nil)
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
</h3><div class="docstring">
|
1456
|
-
<div class="discussion">
|
1457
|
-
|
1458
|
-
<p>Open the file in non-binary, read-only mode, read it and parse it to UTF-8</p>
|
1459
|
-
|
1460
|
-
|
1461
|
-
</div>
|
1462
|
-
</div>
|
1463
|
-
<div class="tags">
|
1464
|
-
<p class="tag_title">Parameters:</p>
|
1465
|
-
<ul class="param">
|
1466
|
-
|
1467
|
-
<li>
|
1468
|
-
|
1469
|
-
<span class='name'>filename</span>
|
1470
|
-
|
1471
|
-
|
1472
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
—
|
1477
|
-
<div class='inline'>
|
1478
|
-
<p>a string with a reference to the file to be opened</p>
|
1479
|
-
</div>
|
1480
|
-
|
1481
|
-
</li>
|
1482
|
-
|
1483
|
-
<li>
|
1484
|
-
|
1485
|
-
<span class='name'>extension</span>
|
1486
|
-
|
1487
|
-
|
1488
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1489
|
-
|
1490
|
-
|
1491
|
-
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1492
|
-
|
1493
|
-
|
1494
|
-
—
|
1495
|
-
<div class='inline'>
|
1496
|
-
<p>an optional string enforcing a certain parser (based on the file extension,
|
1497
|
-
e.g. ‘txt’, ‘csv’ or ‘xls’)</p>
|
1498
|
-
</div>
|
1499
|
-
|
1500
|
-
</li>
|
1501
|
-
|
1502
|
-
</ul>
|
1503
|
-
|
1504
|
-
|
1505
|
-
</div><table class="source_code">
|
1506
|
-
<tr>
|
1507
|
-
<td>
|
1508
|
-
<pre class="lines">
|
1509
|
-
|
1510
|
-
|
1511
|
-
107
|
1512
|
-
108
|
1513
|
-
109
|
1514
|
-
110
|
1515
|
-
111
|
1516
|
-
112
|
1517
|
-
113</pre>
|
1518
|
-
</td>
|
1519
|
-
<td>
|
1520
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 107</span>
|
1521
|
-
|
1522
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_open_text'>open_text</span> <span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_extension'>extension</span><span class='op'>=</span><span class='kw'>nil</span>
|
1523
|
-
<span class='id identifier rubyid_extension'>extension</span> <span class='op'>=</span> <span class='id identifier rubyid_file_extension'>file_extension</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_extension'>extension</span>
|
1524
|
-
<span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>r</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
1525
|
-
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span>
|
1526
|
-
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='id identifier rubyid_text_to_utf8'>text_to_utf8</span><span class='lparen'>(</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span>
|
1527
|
-
<span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>load_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_extension'>extension</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span>
|
1528
|
-
<span class='kw'>end</span></pre>
|
1529
|
-
</td>
|
1530
|
-
</tr>
|
1531
|
-
</table>
|
1532
|
-
</div>
|
1533
|
-
|
1534
|
-
<div class="method_details ">
|
1535
|
-
<h3 class="signature " id="push-instance_method">
|
1536
|
-
|
1537
|
-
- (<tt>Object</tt>) <strong>push</strong>(sheet = Workbook::Sheet.new)
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
</h3><div class="docstring">
|
1544
|
-
<div class="discussion">
|
1545
|
-
|
1546
|
-
<p>Push (like in array) a sheet to the workbook (parameter is optional,
|
1547
|
-
default is a new sheet)</p>
|
1548
|
-
|
1549
|
-
|
1550
|
-
</div>
|
1551
|
-
</div>
|
1552
|
-
<div class="tags">
|
1553
|
-
<p class="tag_title">Parameters:</p>
|
1554
|
-
<ul class="param">
|
1555
|
-
|
1556
|
-
<li>
|
1557
|
-
|
1558
|
-
<span class='name'>sheet</span>
|
1559
|
-
|
1560
|
-
|
1561
|
-
<span class='type'>(<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>)</span>
|
1562
|
-
|
1563
|
-
|
1564
|
-
<em class="default">(defaults to: <tt>Workbook::Sheet.new</tt>)</em>
|
1565
|
-
|
1566
|
-
|
1567
|
-
</li>
|
1568
|
-
|
1569
|
-
</ul>
|
1570
|
-
|
1571
|
-
|
1572
|
-
</div><table class="source_code">
|
1573
|
-
<tr>
|
1574
|
-
<td>
|
1575
|
-
<pre class="lines">
|
1576
|
-
|
1577
|
-
|
1578
|
-
59
|
1579
|
-
60
|
1580
|
-
61</pre>
|
1581
|
-
</td>
|
1582
|
-
<td>
|
1583
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 59</span>
|
1584
|
-
|
1585
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_push'>push</span> <span class='id identifier rubyid_sheet'>sheet</span><span class='op'>=</span><span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Sheet</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
1586
|
-
<span class='kw'>super</span><span class='lparen'>(</span><span class='id identifier rubyid_sheet'>sheet</span><span class='rparen'>)</span>
|
1587
|
-
<span class='kw'>end</span></pre>
|
1588
|
-
</td>
|
1589
|
-
</tr>
|
1590
|
-
</table>
|
1591
|
-
</div>
|
1592
|
-
|
1593
|
-
<div class="method_details ">
|
1594
|
-
<h3 class="signature " id="read-instance_method">
|
1595
|
-
|
1596
|
-
- (<tt>Object</tt>) <strong>read</strong>(stringio_or_string, filetype)
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
</h3><div class="docstring">
|
1603
|
-
<div class="discussion">
|
1604
|
-
|
1605
|
-
<p>Load the CSV data contained in the given StringIO or String object</p>
|
1606
|
-
|
1607
|
-
|
1608
|
-
</div>
|
1609
|
-
</div>
|
1610
|
-
<div class="tags">
|
1611
|
-
<p class="tag_title">Parameters:</p>
|
1612
|
-
<ul class="param">
|
1613
|
-
|
1614
|
-
<li>
|
1615
|
-
|
1616
|
-
<span class='name'>stringio_or_string</span>
|
1617
|
-
|
1618
|
-
|
1619
|
-
<span class='type'>(<tt>StringIO</tt>)</span>
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
—
|
1624
|
-
<div class='inline'>
|
1625
|
-
<p>StringIO stream or String object, with data in CSV format</p>
|
1626
|
-
</div>
|
1627
|
-
|
1628
|
-
</li>
|
1629
|
-
|
1630
|
-
<li>
|
1631
|
-
|
1632
|
-
<span class='name'>filetype</span>
|
1633
|
-
|
1634
|
-
|
1635
|
-
<span class='type'>(<tt>Symbol</tt>)</span>
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
—
|
1640
|
-
<div class='inline'>
|
1641
|
-
<p>(currently only :csv or :txt), indicating the format of the first parameter</p>
|
1642
|
-
</div>
|
1643
|
-
|
1644
|
-
</li>
|
1645
|
-
|
1646
|
-
</ul>
|
1647
|
-
|
1648
|
-
<p class="tag_title">Raises:</p>
|
1649
|
-
<ul class="raise">
|
1650
|
-
|
1651
|
-
<li>
|
1652
|
-
|
1653
|
-
|
1654
|
-
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
</li>
|
1659
|
-
|
1660
|
-
</ul>
|
1661
|
-
|
1662
|
-
</div><table class="source_code">
|
1663
|
-
<tr>
|
1664
|
-
<td>
|
1665
|
-
<pre class="lines">
|
1666
|
-
|
1667
|
-
|
1668
|
-
171
|
1669
|
-
172
|
1670
|
-
173
|
1671
|
-
174
|
1672
|
-
175
|
1673
|
-
176</pre>
|
1674
|
-
</td>
|
1675
|
-
<td>
|
1676
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 171</span>
|
1677
|
-
|
1678
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_stringio_or_string'>stringio_or_string</span><span class='comma'>,</span> <span class='id identifier rubyid_filetype'>filetype</span><span class='rparen'>)</span>
|
1679
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The filetype parameter should be either :csv or :txt</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='lbracket'>[</span><span class='symbol'>:csv</span><span class='comma'>,</span> <span class='symbol'>:txt</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_filetype'>filetype</span><span class='rparen'>)</span>
|
1680
|
-
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='id identifier rubyid_stringio_or_string'>stringio_or_string</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:read</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_stringio_or_string'>stringio_or_string</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span> <span class='op'>:</span> <span class='id identifier rubyid_stringio_or_string'>stringio_or_string</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
1681
|
-
<span class='id identifier rubyid_t'>t</span> <span class='op'>=</span> <span class='id identifier rubyid_text_to_utf8'>text_to_utf8</span><span class='lparen'>(</span><span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span>
|
1682
|
-
<span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='symbol'>:parse_</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_filetype'>filetype</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_t'>t</span><span class='rparen'>)</span>
|
1683
|
-
<span class='kw'>end</span></pre>
|
1684
|
-
</td>
|
1685
|
-
</tr>
|
1686
|
-
</table>
|
1687
|
-
</div>
|
1688
|
-
|
1689
|
-
<div class="method_details ">
|
1690
|
-
<h3 class="signature " id="sheet-instance_method">
|
1691
|
-
|
1692
|
-
- (<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>) <strong>sheet</strong>
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
</h3><div class="docstring">
|
1699
|
-
<div class="discussion">
|
1700
|
-
|
1701
|
-
<p>Sheet returns the first sheet of a workbook, or an empty one.</p>
|
1702
|
-
|
1703
|
-
|
1704
|
-
</div>
|
1705
|
-
</div>
|
1706
|
-
<div class="tags">
|
1707
|
-
|
1708
|
-
<p class="tag_title">Returns:</p>
|
1709
|
-
<ul class="return">
|
1710
|
-
|
1711
|
-
<li>
|
1712
|
-
|
1713
|
-
|
1714
|
-
<span class='type'>(<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>)</span>
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
—
|
1719
|
-
<div class='inline'>
|
1720
|
-
<p>The first sheet, and creates an empty one if one doesn’t exists</p>
|
1721
|
-
</div>
|
1722
|
-
|
1723
|
-
</li>
|
1724
|
-
|
1725
|
-
</ul>
|
1726
|
-
|
1727
|
-
</div><table class="source_code">
|
1728
|
-
<tr>
|
1729
|
-
<td>
|
1730
|
-
<pre class="lines">
|
1731
|
-
|
1732
|
-
|
1733
|
-
66
|
1734
|
-
67
|
1735
|
-
68
|
1736
|
-
69</pre>
|
1737
|
-
</td>
|
1738
|
-
<td>
|
1739
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 66</span>
|
1740
|
-
|
1741
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_sheet'>sheet</span>
|
1742
|
-
<span class='id identifier rubyid_push'>push</span> <span class='const'>Workbook</span><span class='op'>::</span><span class='const'>Sheet</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>unless</span> <span class='id identifier rubyid_first'>first</span>
|
1743
|
-
<span class='id identifier rubyid_first'>first</span>
|
1744
|
-
<span class='kw'>end</span></pre>
|
1745
|
-
</td>
|
1746
|
-
</tr>
|
1747
|
-
</table>
|
1748
|
-
</div>
|
1749
|
-
|
1750
|
-
<div class="method_details ">
|
1751
|
-
<h3 class="signature " id="text_to_utf8-instance_method">
|
1752
|
-
|
1753
|
-
- (<tt>Object</tt>) <strong>text_to_utf8</strong>(text)
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
</h3><div class="docstring">
|
1760
|
-
<div class="discussion">
|
1761
|
-
|
1762
|
-
<p>Helper method to convert text in a file to UTF-8</p>
|
1763
|
-
|
1764
|
-
|
1765
|
-
</div>
|
1766
|
-
</div>
|
1767
|
-
<div class="tags">
|
1768
|
-
<p class="tag_title">Parameters:</p>
|
1769
|
-
<ul class="param">
|
1770
|
-
|
1771
|
-
<li>
|
1772
|
-
|
1773
|
-
<span class='name'>text</span>
|
1774
|
-
|
1775
|
-
|
1776
|
-
<span class='type'>(<tt>String</tt>)</span>
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
—
|
1781
|
-
<div class='inline'>
|
1782
|
-
<p>a string to convert</p>
|
1783
|
-
</div>
|
1784
|
-
|
1785
|
-
</li>
|
1786
|
-
|
1787
|
-
</ul>
|
1788
|
-
|
1789
|
-
|
1790
|
-
</div><table class="source_code">
|
1791
|
-
<tr>
|
1792
|
-
<td>
|
1793
|
-
<pre class="lines">
|
1794
|
-
|
1795
|
-
|
1796
|
-
119
|
1797
|
-
120
|
1798
|
-
121
|
1799
|
-
122
|
1800
|
-
123
|
1801
|
-
124
|
1802
|
-
125
|
1803
|
-
126
|
1804
|
-
127
|
1805
|
-
128
|
1806
|
-
129
|
1807
|
-
130
|
1808
|
-
131
|
1809
|
-
132
|
1810
|
-
133
|
1811
|
-
134
|
1812
|
-
135
|
1813
|
-
136</pre>
|
1814
|
-
</td>
|
1815
|
-
<td>
|
1816
|
-
<pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 119</span>
|
1817
|
-
|
1818
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_text_to_utf8'>text_to_utf8</span> <span class='id identifier rubyid_text'>text</span>
|
1819
|
-
<span class='kw'>if</span> <span class='const'>RUBY_VERSION</span> <span class='op'><</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.9</span><span class='tstring_end'>'</span></span>
|
1820
|
-
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rchardet</span><span class='tstring_end'>'</span></span>
|
1821
|
-
<span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>iconv</span><span class='tstring_end'>'</span></span>
|
1822
|
-
<span class='id identifier rubyid_detected_encoding'>detected_encoding</span> <span class='op'>=</span> <span class='const'>CharDet</span><span class='period'>.</span><span class='id identifier rubyid_detect'>detect</span><span class='lparen'>(</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span>
|
1823
|
-
<span class='id identifier rubyid_detected_encoding'>detected_encoding</span> <span class='op'>=</span> <span class='id identifier rubyid_detected_encoding'>detected_encoding</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>encoding</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
1824
|
-
<span class='id identifier rubyid_text'>text</span> <span class='op'>=</span> <span class='const'>Iconv</span><span class='period'>.</span><span class='id identifier rubyid_conv'>conv</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>UTF-8//TRANSLIT//IGNORE</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='id identifier rubyid_detected_encoding'>detected_encoding</span><span class='comma'>,</span><span class='id identifier rubyid_text'>text</span><span class='rparen'>)</span>
|
1825
|
-
<span class='id identifier rubyid_text'>text</span> <span class='op'>=</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\xEF\xBB\xBF</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='comment'># removing the BOM...
|
1826
|
-
</span> <span class='kw'>else</span>
|
1827
|
-
<span class='kw'>unless</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_valid_encoding?'>valid_encoding?</span> <span class='kw'>and</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_encoding'>encoding</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>"</span></span>
|
1828
|
-
<span class='comment'># TODO: had some ruby 1.9 problems with rchardet ... but ideally it or a similar functionality will be reintroduced
|
1829
|
-
</span> <span class='id identifier rubyid_source_encoding'>source_encoding</span> <span class='op'>=</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_valid_encoding?'>valid_encoding?</span> <span class='op'>?</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_encoding'>encoding</span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>US-ASCII</span><span class='tstring_end'>"</span></span>
|
1830
|
-
<span class='id identifier rubyid_text'>text</span> <span class='op'>=</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>UTF-8</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='id identifier rubyid_source_encoding'>source_encoding</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='symbol'>:invalid</span><span class='op'>=></span><span class='symbol'>:replace</span><span class='comma'>,</span> <span class='symbol'>:undef</span><span class='op'>=></span><span class='symbol'>:replace</span><span class='comma'>,</span> <span class='symbol'>:replace</span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
1831
|
-
<span class='id identifier rubyid_text'>text</span> <span class='op'>=</span> <span class='id identifier rubyid_text'>text</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\u0000</span><span class='tstring_end'>"</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='comment'># TODO: this cleanup of nil values isn't supposed to be needed...
|
1832
|
-
</span> <span class='kw'>end</span>
|
1833
|
-
<span class='kw'>end</span>
|
1834
|
-
<span class='kw'>return</span> <span class='id identifier rubyid_text'>text</span>
|
1835
|
-
<span class='kw'>end</span></pre>
|
1836
|
-
</td>
|
1837
|
-
</tr>
|
1838
|
-
</table>
|
1839
|
-
</div>
|
1840
|
-
|
1841
|
-
</div>
|
1842
|
-
|
1843
|
-
</div>
|
1844
|
-
|
1845
|
-
<div id="footer">
|
1846
|
-
Generated on Sun May 19 23:16:31 2013 by
|
1847
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1848
|
-
0.8.5.2 (ruby-1.9.3).
|
1849
|
-
</div>
|
1850
|
-
|
1851
|
-
</body>
|
1852
|
-
</html>
|