workbook 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.yardoc/checksums +18 -0
  2. data/.yardoc/object_types +3 -0
  3. data/.yardoc/objects/root.dat +0 -0
  4. data/.yardoc/proxy_types +0 -0
  5. data/Gemfile.lock +1 -1
  6. data/{readme.markdown → README.md} +36 -10
  7. data/doc/RubyXL.html +128 -0
  8. data/doc/RubyXL/Cell.html +202 -0
  9. data/doc/RubyXL/Workbook.html +447 -0
  10. data/doc/Workbook.html +130 -0
  11. data/doc/Workbook/Book.html +1484 -0
  12. data/doc/Workbook/Cell.html +1402 -0
  13. data/doc/Workbook/Format.html +654 -0
  14. data/doc/Workbook/Modules.html +117 -0
  15. data/doc/Workbook/Modules/RawObjectsStorage.html +508 -0
  16. data/doc/Workbook/Modules/TableDiffSort.html +620 -0
  17. data/doc/Workbook/Modules/TypeParser.html +1012 -0
  18. data/doc/Workbook/Readers.html +117 -0
  19. data/doc/Workbook/Readers/CsvReader.html +262 -0
  20. data/doc/Workbook/Readers/TxtReader.html +238 -0
  21. data/doc/Workbook/Readers/XlsReader.html +362 -0
  22. data/doc/Workbook/Readers/XlsShared.html +189 -0
  23. data/doc/Workbook/Readers/XlsxReader.html +295 -0
  24. data/doc/Workbook/Row.html +1939 -0
  25. data/doc/Workbook/Sheet.html +528 -0
  26. data/doc/Workbook/Table.html +883 -0
  27. data/doc/Workbook/Template.html +639 -0
  28. data/doc/Workbook/Writers.html +117 -0
  29. data/doc/Workbook/Writers/CsvTableWriter.html +175 -0
  30. data/doc/Workbook/Writers/XlsWriter.html +865 -0
  31. data/doc/_index.html +336 -0
  32. data/doc/class_list.html +53 -0
  33. data/doc/css/common.css +1 -0
  34. data/doc/css/full_list.css +57 -0
  35. data/doc/css/style.css +328 -0
  36. data/doc/file.README.html +236 -0
  37. data/doc/file_list.html +55 -0
  38. data/doc/frames.html +28 -0
  39. data/doc/index.html +236 -0
  40. data/doc/js/app.js +214 -0
  41. data/doc/js/full_list.js +173 -0
  42. data/doc/js/jquery.js +4 -0
  43. data/doc/method_list.html +972 -0
  44. data/doc/top-level-namespace.html +112 -0
  45. data/lib/workbook/book.rb +38 -29
  46. data/lib/workbook/cell.rb +25 -0
  47. data/lib/workbook/format.rb +9 -2
  48. data/lib/workbook/modules/raw_objects_storage.rb +5 -0
  49. data/lib/workbook/modules/table_diff_sort.rb +8 -6
  50. data/lib/workbook/modules/type_parser.rb +16 -3
  51. data/lib/workbook/readers/xls_reader.rb +1 -70
  52. data/lib/workbook/readers/xls_shared.rb +75 -0
  53. data/lib/workbook/row.rb +89 -17
  54. data/lib/workbook/sheet.rb +26 -0
  55. data/lib/workbook/table.rb +20 -1
  56. data/lib/workbook/template.rb +12 -11
  57. data/lib/workbook/writers/xls_writer.rb +19 -77
  58. data/test/test_modules_table_diff_sort.rb +19 -6
  59. data/test/test_row.rb +54 -0
  60. data/test/test_sheet.rb +8 -0
  61. data/test/test_table.rb +22 -3
  62. data/test/test_writers_xls_writer.rb +3 -0
  63. data/workbook.gemspec +1 -1
  64. metadata +46 -3
data/doc/Workbook.html ADDED
@@ -0,0 +1,130 @@
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
+ Module: Workbook
8
+
9
+ &mdash; Documentation by YARD 0.8.3
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 (W)</a> &raquo;
35
+
36
+
37
+ <span class="title">Workbook</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>Module: Workbook
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/workbook/readers/xlsx_reader.rb<span class="defines">,<br />
83
+ lib/workbook.rb,<br /> lib/workbook/row.rb,<br /> lib/workbook/cell.rb,<br /> lib/workbook/book.rb,<br /> lib/workbook/sheet.rb,<br /> lib/workbook/table.rb,<br /> lib/workbook/format.rb,<br /> lib/workbook/template.rb,<br /> lib/workbook/readers/txt_reader.rb,<br /> lib/workbook/readers/csv_reader.rb,<br /> lib/workbook/writers/xls_writer.rb,<br /> lib/workbook/readers/xls_reader.rb,<br /> lib/workbook/readers/xls_shared.rb,<br /> lib/workbook/modules/type_parser.rb,<br /> lib/workbook/modules/table_diff_sort.rb,<br /> lib/workbook/writers/csv_table_writer.rb,<br /> lib/workbook/modules/raw_objects_storage.rb</span>
84
+ </dd>
85
+
86
+ </dl>
87
+ <div class="clear"></div>
88
+
89
+ <h2>Overview</h2><div class="docstring">
90
+ <div class="discussion">
91
+
92
+ <p>end of monkey patch</p>
93
+
94
+
95
+ </div>
96
+ </div>
97
+ <div class="tags">
98
+
99
+
100
+ </div><h2>Defined Under Namespace</h2>
101
+ <p class="children">
102
+
103
+
104
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Workbook/Modules.html" title="Workbook::Modules (module)">Modules</a></span>, <span class='object_link'><a href="Workbook/Readers.html" title="Workbook::Readers (module)">Readers</a></span>, <span class='object_link'><a href="Workbook/Writers.html" title="Workbook::Writers (module)">Writers</a></span>
105
+
106
+
107
+
108
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Workbook/Book.html" title="Workbook::Book (class)">Book</a></span>, <span class='object_link'><a href="Workbook/Cell.html" title="Workbook::Cell (class)">Cell</a></span>, <span class='object_link'><a href="Workbook/Format.html" title="Workbook::Format (class)">Format</a></span>, <span class='object_link'><a href="Workbook/Row.html" title="Workbook::Row (class)">Row</a></span>, <span class='object_link'><a href="Workbook/Sheet.html" title="Workbook::Sheet (class)">Sheet</a></span>, <span class='object_link'><a href="Workbook/Table.html" title="Workbook::Table (class)">Table</a></span>, <span class='object_link'><a href="Workbook/Template.html" title="Workbook::Template (class)">Template</a></span>
109
+
110
+
111
+ </p>
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ </div>
122
+
123
+ <div id="footer">
124
+ Generated on Thu Jan 17 13:15:56 2013 by
125
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
+ 0.8.3 (ruby-1.8.7).
127
+ </div>
128
+
129
+ </body>
130
+ </html>
@@ -0,0 +1,1484 @@
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
+ &mdash; Documentation by YARD 0.8.3
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> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../Workbook.html" title="Workbook (module)">Workbook</a></span></span>
36
+ &raquo;
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/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/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
+ </ul>
229
+
230
+ <h2>
231
+ Instance Method Summary
232
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
233
+ </h2>
234
+
235
+ <ul class="summary">
236
+
237
+ <li class="public ">
238
+ <span class="summary_signature">
239
+
240
+ <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>
241
+
242
+
243
+
244
+ </span>
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+ <span class="summary_desc"><div class='inline'>
255
+ <p>Create or open the existing sheet at an index value.</p>
256
+ </div></span>
257
+
258
+ </li>
259
+
260
+
261
+ <li class="public ">
262
+ <span class="summary_signature">
263
+
264
+ <a href="#file_extension-instance_method" title="#file_extension (instance method)">- (String) <strong>file_extension</strong>(filename) </a>
265
+
266
+
267
+
268
+ </span>
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+ <span class="summary_desc"><div class='inline'>
279
+ <p>The file extension.</p>
280
+ </div></span>
281
+
282
+ </li>
283
+
284
+
285
+ <li class="public ">
286
+ <span class="summary_signature">
287
+
288
+ <a href="#has_contents%3F-instance_method" title="#has_contents? (instance method)">- (Boolean) <strong>has_contents?</strong> </a>
289
+
290
+
291
+
292
+ </span>
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+ <span class="summary_desc"><div class='inline'>
303
+ <p>If the first sheet has any contents.</p>
304
+ </div></span>
305
+
306
+ </li>
307
+
308
+
309
+ <li class="public ">
310
+ <span class="summary_signature">
311
+
312
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (Workbook::Book) <strong>initialize</strong>(sheet = Workbook::Sheet.new([], self, options={})) </a>
313
+
314
+
315
+
316
+ </span>
317
+
318
+
319
+ <span class="note title constructor">constructor</span>
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+ <span class="summary_desc"><div class='inline'></div></span>
329
+
330
+ </li>
331
+
332
+
333
+ <li class="public ">
334
+ <span class="summary_signature">
335
+
336
+ <a href="#open-instance_method" title="#open (instance method)">- (Workbook::Book) <strong>open</strong>(filename, extension = nil) </a>
337
+
338
+
339
+
340
+ </span>
341
+
342
+
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+ <span class="summary_desc"><div class='inline'>
351
+ <p>Loads an external file into an existing worbook.</p>
352
+ </div></span>
353
+
354
+ </li>
355
+
356
+
357
+ <li class="public ">
358
+ <span class="summary_signature">
359
+
360
+ <a href="#open_binary-instance_method" title="#open_binary (instance method)">- (Workbook::Book) <strong>open_binary</strong>(filename, extension = nil) </a>
361
+
362
+
363
+
364
+ </span>
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+ <span class="summary_desc"><div class='inline'>
375
+ <p>Open the file in binary, read-only mode, do not read it, but pas it throug
376
+ to the extension determined loaded.</p>
377
+ </div></span>
378
+
379
+ </li>
380
+
381
+
382
+ <li class="public ">
383
+ <span class="summary_signature">
384
+
385
+ <a href="#open_text-instance_method" title="#open_text (instance method)">- (Object) <strong>open_text</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 non-binary, read-only mode, read it and parse it to UTF-8.</p>
401
+ </div></span>
402
+
403
+ </li>
404
+
405
+
406
+ <li class="public ">
407
+ <span class="summary_signature">
408
+
409
+ <a href="#push-instance_method" title="#push (instance method)">- (Object) <strong>push</strong>(sheet = Workbook::Sheet.new) </a>
410
+
411
+
412
+
413
+ </span>
414
+
415
+
416
+
417
+
418
+
419
+
420
+
421
+
422
+
423
+ <span class="summary_desc"><div class='inline'>
424
+ <p>Push (like in array) a sheet to the workbook (parameter is optional,
425
+ default is a new sheet).</p>
426
+ </div></span>
427
+
428
+ </li>
429
+
430
+
431
+ <li class="public ">
432
+ <span class="summary_signature">
433
+
434
+ <a href="#sheet-instance_method" title="#sheet (instance method)">- (Workbook::Sheet) <strong>sheet</strong> </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>Sheet returns the first sheet of a workbook, or an empty one.</p>
450
+ </div></span>
451
+
452
+ </li>
453
+
454
+
455
+ </ul>
456
+
457
+
458
+
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+ <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>
468
+ <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>
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+ <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>
479
+ <p class="inherited"><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>
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+ <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>
490
+ <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#ms_formatting_to_strftime-instance_method" title="Workbook::Readers::XlsxReader#ms_formatting_to_strftime (method)">#ms_formatting_to_strftime</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>
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+ <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>
501
+ <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#ms_formatting_to_strftime-instance_method" title="Workbook::Readers::XlsReader#ms_formatting_to_strftime (method)">#ms_formatting_to_strftime</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>, <span class='object_link'><a href="Readers/XlsReader.html#xls_color_to_html_hex-instance_method" title="Workbook::Readers::XlsReader#xls_color_to_html_hex (method)">#xls_color_to_html_hex</a></span></p>
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+ <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>
512
+ <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>
513
+
514
+
515
+
516
+
517
+
518
+
519
+
520
+ <div id="constructor_details" class="method_details_list">
521
+ <h2>Constructor Details</h2>
522
+
523
+ <div class="method_details first">
524
+ <h3 class="signature first" id="initialize-instance_method">
525
+
526
+ - (<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={}))
527
+
528
+
529
+
530
+
531
+
532
+ </h3><div class="docstring">
533
+ <div class="discussion">
534
+
535
+
536
+ </div>
537
+ </div>
538
+ <div class="tags">
539
+ <p class="tag_title">Parameters:</p>
540
+ <ul class="param">
541
+
542
+ <li>
543
+
544
+ <span class='name'>sheet</span>
545
+
546
+
547
+ <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>
548
+
549
+
550
+ <em class="default">(defaults to: <tt>Workbook::Sheet.new([], self, options={})</tt>)</em>
551
+
552
+
553
+ &mdash;
554
+ <div class='inline'>
555
+ <p>create a new workbook based on an existing sheet, or initialize a sheet
556
+ based on the array</p>
557
+ </div>
558
+
559
+ </li>
560
+
561
+ </ul>
562
+
563
+
564
+ </div><table class="source_code">
565
+ <tr>
566
+ <td>
567
+ <pre class="lines">
568
+
569
+
570
+ 26
571
+ 27
572
+ 28
573
+ 29
574
+ 30
575
+ 31
576
+ 32</pre>
577
+ </td>
578
+ <td>
579
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 26</span>
580
+
581
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_initialize identifier id'>initialize</span> <span class='rubyid_sheet identifier id'>sheet</span><span class='assign token'>=</span><span class='rubyid_Workbook constant id'>Workbook</span><span class='colon2 op'>::</span><span class='rubyid_Sheet constant id'>Sheet</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='lbrack token'>[</span><span class='rbrack token'>]</span><span class='comma token'>,</span> <span class='rubyid_self self kw'>self</span><span class='comma token'>,</span> <span class='rubyid_options identifier id'>options</span><span class='assign token'>=</span><span class='lbrace token'>{</span><span class='rbrace token'>}</span><span class='rparen token'>)</span>
582
+ <span class='rubyid_if if kw'>if</span> <span class='rubyid_sheet identifier id'>sheet</span><span class='dot token'>.</span><span class='rubyid_is_a? fid id'>is_a?</span> <span class='rubyid_Workbook constant id'>Workbook</span><span class='colon2 op'>::</span><span class='rubyid_Sheet constant id'>Sheet</span>
583
+ <span class='rubyid_push identifier id'>push</span> <span class='rubyid_sheet identifier id'>sheet</span>
584
+ <span class='rubyid_else else kw'>else</span>
585
+ <span class='rubyid_push identifier id'>push</span> <span class='rubyid_Workbook constant id'>Workbook</span><span class='colon2 op'>::</span><span class='rubyid_Sheet constant id'>Sheet</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span><span class='lparen token'>(</span><span class='rubyid_sheet identifier id'>sheet</span><span class='comma token'>,</span> <span class='rubyid_self self kw'>self</span><span class='comma token'>,</span> <span class='rubyid_options identifier id'>options</span><span class='rparen token'>)</span>
586
+ <span class='rubyid_end end kw'>end</span>
587
+ <span class='rubyid_end end kw'>end</span>
588
+ </pre>
589
+ </td>
590
+ </tr>
591
+ </table>
592
+ </div>
593
+
594
+ </div>
595
+
596
+ <div id="instance_attr_details" class="attr_details">
597
+ <h2>Instance Attribute Details</h2>
598
+
599
+
600
+ <span id="template=-instance_method"></span>
601
+ <div class="method_details first">
602
+ <h3 class="signature first" id="template-instance_method">
603
+
604
+ - (<tt><span class='object_link'><a href="Format.html" title="Workbook::Format (class)">Workbook::Format</a></span></tt>) <strong>template</strong>
605
+
606
+
607
+
608
+
609
+
610
+ </h3><div class="docstring">
611
+ <div class="discussion">
612
+
613
+ <p>Returns the template describing how the document should be/is formatted</p>
614
+
615
+
616
+ </div>
617
+ </div>
618
+ <div class="tags">
619
+
620
+ <p class="tag_title">Returns:</p>
621
+ <ul class="return">
622
+
623
+ <li>
624
+
625
+
626
+ <span class='type'>(<tt><span class='object_link'><a href="Format.html" title="Workbook::Format (class)">Workbook::Format</a></span></tt>)</span>
627
+
628
+
629
+
630
+ &mdash;
631
+ <div class='inline'>
632
+ <p>returns the template describing how the document should be/is formatted</p>
633
+ </div>
634
+
635
+ </li>
636
+
637
+ </ul>
638
+
639
+ </div><table class="source_code">
640
+ <tr>
641
+ <td>
642
+ <pre class="lines">
643
+
644
+
645
+ 35
646
+ 36
647
+ 37</pre>
648
+ </td>
649
+ <td>
650
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 35</span>
651
+
652
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_template identifier id'>template</span>
653
+ <span class='rubyid_@template ivar id'>@template</span>
654
+ <span class='rubyid_end end kw'>end</span>
655
+ </pre>
656
+ </td>
657
+ </tr>
658
+ </table>
659
+ </div>
660
+
661
+
662
+ <span id="title=-instance_method"></span>
663
+ <div class="method_details ">
664
+ <h3 class="signature " id="title-instance_method">
665
+
666
+ - (<tt>String</tt>) <strong>title</strong>
667
+
668
+
669
+
670
+
671
+
672
+ </h3><div class="docstring">
673
+ <div class="discussion">
674
+
675
+ <p>The title of the workbook</p>
676
+
677
+
678
+ </div>
679
+ </div>
680
+ <div class="tags">
681
+
682
+ <p class="tag_title">Returns:</p>
683
+ <ul class="return">
684
+
685
+ <li>
686
+
687
+
688
+ <span class='type'>(<tt>String</tt>)</span>
689
+
690
+
691
+
692
+ &mdash;
693
+ <div class='inline'>
694
+ <p>the title of the workbook</p>
695
+ </div>
696
+
697
+ </li>
698
+
699
+ </ul>
700
+
701
+ </div><table class="source_code">
702
+ <tr>
703
+ <td>
704
+ <pre class="lines">
705
+
706
+
707
+ 48
708
+ 49
709
+ 50</pre>
710
+ </td>
711
+ <td>
712
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 48</span>
713
+
714
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_title identifier id'>title</span>
715
+ <span class='rubyid_@title ivar id'>@title</span>
716
+ <span class='rubyid_end end kw'>end</span>
717
+ </pre>
718
+ </td>
719
+ </tr>
720
+ </table>
721
+ </div>
722
+
723
+ </div>
724
+
725
+
726
+ <div id="class_method_details" class="method_details_list">
727
+ <h2>Class Method Details</h2>
728
+
729
+
730
+ <div class="method_details first">
731
+ <h3 class="signature first" id="open-class_method">
732
+
733
+ + (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>open</strong>(filename, extension = nil)
734
+
735
+
736
+
737
+
738
+
739
+ </h3><div class="docstring">
740
+ <div class="discussion">
741
+
742
+ <p>Create an instance from a file, using open.</p>
743
+
744
+
745
+ </div>
746
+ </div>
747
+ <div class="tags">
748
+ <p class="tag_title">Parameters:</p>
749
+ <ul class="param">
750
+
751
+ <li>
752
+
753
+ <span class='name'>filename</span>
754
+
755
+
756
+ <span class='type'>(<tt>String</tt>)</span>
757
+
758
+
759
+
760
+ &mdash;
761
+ <div class='inline'>
762
+ <p>of the document</p>
763
+ </div>
764
+
765
+ </li>
766
+
767
+ <li>
768
+
769
+ <span class='name'>extension</span>
770
+
771
+
772
+ <span class='type'>(<tt>String</tt>)</span>
773
+
774
+
775
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
776
+
777
+
778
+ &mdash;
779
+ <div class='inline'>
780
+ <p>of the document (not required). The parser used is based on the extension
781
+ of the file, this option allows you to override the default.</p>
782
+ </div>
783
+
784
+ </li>
785
+
786
+ </ul>
787
+
788
+ <p class="tag_title">Returns:</p>
789
+ <ul class="return">
790
+
791
+ <li>
792
+
793
+
794
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>)</span>
795
+
796
+
797
+
798
+ &mdash;
799
+ <div class='inline'>
800
+ <p>A new instance, based on the filename</p>
801
+ </div>
802
+
803
+ </li>
804
+
805
+ </ul>
806
+
807
+ </div><table class="source_code">
808
+ <tr>
809
+ <td>
810
+ <pre class="lines">
811
+
812
+
813
+ 124
814
+ 125
815
+ 126
816
+ 127
817
+ 128</pre>
818
+ </td>
819
+ <td>
820
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 124</span>
821
+
822
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span> <span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_extension identifier id'>extension</span><span class='assign token'>=</span><span class='rubyid_nil nil kw'>nil</span>
823
+ <span class='rubyid_wb identifier id'>wb</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span>
824
+ <span class='rubyid_wb identifier id'>wb</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span> <span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_extension identifier id'>extension</span>
825
+ <span class='rubyid_return return kw'>return</span> <span class='rubyid_wb identifier id'>wb</span>
826
+ <span class='rubyid_end end kw'>end</span>
827
+ </pre>
828
+ </td>
829
+ </tr>
830
+ </table>
831
+ </div>
832
+
833
+ </div>
834
+
835
+ <div id="instance_method_details" class="method_details_list">
836
+ <h2>Instance Method Details</h2>
837
+
838
+
839
+ <div class="method_details first">
840
+ <h3 class="signature first" id="create_or_open_sheet_at-instance_method">
841
+
842
+ - (<tt>Object</tt>) <strong>create_or_open_sheet_at</strong>(index)
843
+
844
+
845
+
846
+
847
+
848
+ </h3><div class="docstring">
849
+ <div class="discussion">
850
+
851
+ <p>Create or open the existing sheet at an index value</p>
852
+
853
+
854
+ </div>
855
+ </div>
856
+ <div class="tags">
857
+ <p class="tag_title">Parameters:</p>
858
+ <ul class="param">
859
+
860
+ <li>
861
+
862
+ <span class='name'>index</span>
863
+
864
+
865
+ <span class='type'>(<tt>Integer</tt>)</span>
866
+
867
+
868
+
869
+ &mdash;
870
+ <div class='inline'>
871
+ <p>the index of the sheet</p>
872
+ </div>
873
+
874
+ </li>
875
+
876
+ </ul>
877
+
878
+
879
+ </div><table class="source_code">
880
+ <tr>
881
+ <td>
882
+ <pre class="lines">
883
+
884
+
885
+ 133
886
+ 134
887
+ 135
888
+ 136
889
+ 137
890
+ 138</pre>
891
+ </td>
892
+ <td>
893
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 133</span>
894
+
895
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_create_or_open_sheet_at identifier id'>create_or_open_sheet_at</span> <span class='rubyid_index identifier id'>index</span>
896
+ <span class='rubyid_s identifier id'>s</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='lbrack token'>[</span><span class='rubyid_index identifier id'>index</span><span class='rbrack token'>]</span>
897
+ <span class='rubyid_s identifier id'>s</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span><span class='lbrack token'>[</span><span class='rubyid_index identifier id'>index</span><span class='rbrack token'>]</span> <span class='assign token'>=</span> <span class='rubyid_Workbook constant id'>Workbook</span><span class='colon2 op'>::</span><span class='rubyid_Sheet constant id'>Sheet</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_s identifier id'>s</span> <span class='eq op'>==</span> <span class='rubyid_nil nil kw'>nil</span>
898
+ <span class='rubyid_s identifier id'>s</span><span class='dot token'>.</span><span class='rubyid_book identifier id'>book</span> <span class='assign token'>=</span> <span class='rubyid_self self kw'>self</span>
899
+ <span class='rubyid_s identifier id'>s</span>
900
+ <span class='rubyid_end end kw'>end</span>
901
+ </pre>
902
+ </td>
903
+ </tr>
904
+ </table>
905
+ </div>
906
+
907
+ <div class="method_details ">
908
+ <h3 class="signature " id="file_extension-instance_method">
909
+
910
+ - (<tt>String</tt>) <strong>file_extension</strong>(filename)
911
+
912
+
913
+
914
+
915
+
916
+ </h3><div class="docstring">
917
+ <div class="discussion">
918
+
919
+ <p>The file extension</p>
920
+
921
+
922
+ </div>
923
+ </div>
924
+ <div class="tags">
925
+ <p class="tag_title">Parameters:</p>
926
+ <ul class="param">
927
+
928
+ <li>
929
+
930
+ <span class='name'>filename</span>
931
+
932
+
933
+ <span class='type'>(<tt>String</tt>)</span>
934
+
935
+
936
+
937
+ &mdash;
938
+ <div class='inline'>
939
+ <p>The full filename, or path</p>
940
+ </div>
941
+
942
+ </li>
943
+
944
+ </ul>
945
+
946
+ <p class="tag_title">Returns:</p>
947
+ <ul class="return">
948
+
949
+ <li>
950
+
951
+
952
+ <span class='type'>(<tt>String</tt>)</span>
953
+
954
+
955
+
956
+ &mdash;
957
+ <div class='inline'>
958
+ <p>The file extension</p>
959
+ </div>
960
+
961
+ </li>
962
+
963
+ </ul>
964
+
965
+ </div><table class="source_code">
966
+ <tr>
967
+ <td>
968
+ <pre class="lines">
969
+
970
+
971
+ 115
972
+ 116
973
+ 117</pre>
974
+ </td>
975
+ <td>
976
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 115</span>
977
+
978
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_file_extension identifier id'>file_extension</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='rparen token'>)</span>
979
+ <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_extname identifier id'>extname</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_gsub identifier id'>gsub</span><span class='lparen token'>(</span><span class='string val'>'.'</span><span class='comma token'>,</span><span class='string val'>''</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='rubyid_downcase identifier id'>downcase</span> <span class='rubyid_if if_mod kw'>if</span> <span class='rubyid_filename identifier id'>filename</span>
980
+ <span class='rubyid_end end kw'>end</span>
981
+ </pre>
982
+ </td>
983
+ </tr>
984
+ </table>
985
+ </div>
986
+
987
+ <div class="method_details ">
988
+ <h3 class="signature " id="has_contents?-instance_method">
989
+
990
+ - (<tt>Boolean</tt>) <strong>has_contents?</strong>
991
+
992
+
993
+
994
+
995
+
996
+ </h3><div class="docstring">
997
+ <div class="discussion">
998
+
999
+ <p>If the first sheet has any contents</p>
1000
+
1001
+
1002
+ </div>
1003
+ </div>
1004
+ <div class="tags">
1005
+
1006
+ <p class="tag_title">Returns:</p>
1007
+ <ul class="return">
1008
+
1009
+ <li>
1010
+
1011
+
1012
+ <span class='type'>(<tt>Boolean</tt>)</span>
1013
+
1014
+
1015
+
1016
+ &mdash;
1017
+ <div class='inline'>
1018
+ <p>returns true if the first sheet has contents</p>
1019
+ </div>
1020
+
1021
+ </li>
1022
+
1023
+ </ul>
1024
+
1025
+ </div><table class="source_code">
1026
+ <tr>
1027
+ <td>
1028
+ <pre class="lines">
1029
+
1030
+
1031
+ 70
1032
+ 71
1033
+ 72</pre>
1034
+ </td>
1035
+ <td>
1036
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 70</span>
1037
+
1038
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_has_contents? fid id'>has_contents?</span>
1039
+ <span class='rubyid_sheet identifier id'>sheet</span><span class='dot token'>.</span><span class='rubyid_has_contents? fid id'>has_contents?</span>
1040
+ <span class='rubyid_end end kw'>end</span>
1041
+ </pre>
1042
+ </td>
1043
+ </tr>
1044
+ </table>
1045
+ </div>
1046
+
1047
+ <div class="method_details ">
1048
+ <h3 class="signature " id="open-instance_method">
1049
+
1050
+ - (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>open</strong>(filename, extension = nil)
1051
+
1052
+
1053
+
1054
+
1055
+
1056
+ </h3><div class="docstring">
1057
+ <div class="discussion">
1058
+
1059
+ <p>Loads an external file into an existing worbook</p>
1060
+
1061
+
1062
+ </div>
1063
+ </div>
1064
+ <div class="tags">
1065
+ <p class="tag_title">Parameters:</p>
1066
+ <ul class="param">
1067
+
1068
+ <li>
1069
+
1070
+ <span class='name'>filename</span>
1071
+
1072
+
1073
+ <span class='type'>(<tt>String</tt>)</span>
1074
+
1075
+
1076
+
1077
+ &mdash;
1078
+ <div class='inline'>
1079
+ <p>a string with a reference to the file to be opened</p>
1080
+ </div>
1081
+
1082
+ </li>
1083
+
1084
+ <li>
1085
+
1086
+ <span class='name'>extension</span>
1087
+
1088
+
1089
+ <span class='type'>(<tt>String</tt>)</span>
1090
+
1091
+
1092
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1093
+
1094
+
1095
+ &mdash;
1096
+ <div class='inline'>
1097
+ <p>an optional string enforcing a certain parser (based on the file extension,
1098
+ e.g. ‘txt’, ‘csv’ or ‘xls’)</p>
1099
+ </div>
1100
+
1101
+ </li>
1102
+
1103
+ </ul>
1104
+
1105
+ <p class="tag_title">Returns:</p>
1106
+ <ul class="return">
1107
+
1108
+ <li>
1109
+
1110
+
1111
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>)</span>
1112
+
1113
+
1114
+
1115
+ &mdash;
1116
+ <div class='inline'>
1117
+ <p>A new instance, based on the filename</p>
1118
+ </div>
1119
+
1120
+ </li>
1121
+
1122
+ </ul>
1123
+
1124
+ </div><table class="source_code">
1125
+ <tr>
1126
+ <td>
1127
+ <pre class="lines">
1128
+
1129
+
1130
+ 79
1131
+ 80
1132
+ 81
1133
+ 82
1134
+ 83
1135
+ 84
1136
+ 85
1137
+ 86</pre>
1138
+ </td>
1139
+ <td>
1140
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 79</span>
1141
+
1142
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_open identifier id'>open</span> <span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_extension identifier id'>extension</span><span class='assign token'>=</span><span class='rubyid_nil nil kw'>nil</span>
1143
+ <span class='rubyid_extension identifier id'>extension</span> <span class='assign token'>=</span> <span class='rubyid_file_extension identifier id'>file_extension</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='rparen token'>)</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_extension identifier id'>extension</span>
1144
+ <span class='rubyid_if if kw'>if</span> <span class='lbrack token'>[</span><span class='string val'>'txt'</span><span class='comma token'>,</span><span class='string val'>'csv'</span><span class='comma token'>,</span><span class='string val'>'xml'</span><span class='rbrack token'>]</span><span class='dot token'>.</span><span class='rubyid_include? fid id'>include?</span><span class='lparen token'>(</span><span class='rubyid_extension identifier id'>extension</span><span class='rparen token'>)</span>
1145
+ <span class='rubyid_open_text identifier id'>open_text</span> <span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_extension identifier id'>extension</span>
1146
+ <span class='rubyid_else else kw'>else</span>
1147
+ <span class='rubyid_open_binary identifier id'>open_binary</span> <span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_extension identifier id'>extension</span>
1148
+ <span class='rubyid_end end kw'>end</span>
1149
+ <span class='rubyid_end end kw'>end</span>
1150
+ </pre>
1151
+ </td>
1152
+ </tr>
1153
+ </table>
1154
+ </div>
1155
+
1156
+ <div class="method_details ">
1157
+ <h3 class="signature " id="open_binary-instance_method">
1158
+
1159
+ - (<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>) <strong>open_binary</strong>(filename, extension = nil)
1160
+
1161
+
1162
+
1163
+
1164
+
1165
+ </h3><div class="docstring">
1166
+ <div class="discussion">
1167
+
1168
+ <p>Open the file in binary, read-only mode, do not read it, but pas it throug
1169
+ to the extension determined loaded</p>
1170
+
1171
+
1172
+ </div>
1173
+ </div>
1174
+ <div class="tags">
1175
+ <p class="tag_title">Parameters:</p>
1176
+ <ul class="param">
1177
+
1178
+ <li>
1179
+
1180
+ <span class='name'>filename</span>
1181
+
1182
+
1183
+ <span class='type'>(<tt>String</tt>)</span>
1184
+
1185
+
1186
+
1187
+ &mdash;
1188
+ <div class='inline'>
1189
+ <p>a string with a reference to the file to be opened</p>
1190
+ </div>
1191
+
1192
+ </li>
1193
+
1194
+ <li>
1195
+
1196
+ <span class='name'>extension</span>
1197
+
1198
+
1199
+ <span class='type'>(<tt>String</tt>)</span>
1200
+
1201
+
1202
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1203
+
1204
+
1205
+ &mdash;
1206
+ <div class='inline'>
1207
+ <p>an optional string enforcing a certain parser (based on the file extension,
1208
+ e.g. ‘txt’, ‘csv’ or ‘xls’)</p>
1209
+ </div>
1210
+
1211
+ </li>
1212
+
1213
+ </ul>
1214
+
1215
+ <p class="tag_title">Returns:</p>
1216
+ <ul class="return">
1217
+
1218
+ <li>
1219
+
1220
+
1221
+ <span class='type'>(<tt><span class='object_link'><a href="" title="Workbook::Book (class)">Workbook::Book</a></span></tt>)</span>
1222
+
1223
+
1224
+
1225
+ &mdash;
1226
+ <div class='inline'>
1227
+ <p>A new instance, based on the filename</p>
1228
+ </div>
1229
+
1230
+ </li>
1231
+
1232
+ </ul>
1233
+
1234
+ </div><table class="source_code">
1235
+ <tr>
1236
+ <td>
1237
+ <pre class="lines">
1238
+
1239
+
1240
+ 93
1241
+ 94
1242
+ 95
1243
+ 96
1244
+ 97</pre>
1245
+ </td>
1246
+ <td>
1247
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 93</span>
1248
+
1249
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_open_binary identifier id'>open_binary</span> <span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_extension identifier id'>extension</span><span class='assign token'>=</span><span class='rubyid_nil nil kw'>nil</span>
1250
+ <span class='rubyid_extension identifier id'>extension</span> <span class='assign token'>=</span> <span class='rubyid_file_extension identifier id'>file_extension</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='rparen token'>)</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_extension identifier id'>extension</span>
1251
+ <span class='rubyid_f identifier id'>f</span> <span class='assign token'>=</span> <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span><span class='string val'>'rb'</span><span class='rparen token'>)</span>
1252
+ <span class='rubyid_send identifier id'>send</span><span class='lparen token'>(</span><span class='dstring node'>&quot;load_#{extension}&quot;</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='comma token'>,</span><span class='rubyid_f identifier id'>f</span><span class='rparen token'>)</span>
1253
+ <span class='rubyid_end end kw'>end</span>
1254
+ </pre>
1255
+ </td>
1256
+ </tr>
1257
+ </table>
1258
+ </div>
1259
+
1260
+ <div class="method_details ">
1261
+ <h3 class="signature " id="open_text-instance_method">
1262
+
1263
+ - (<tt>Object</tt>) <strong>open_text</strong>(filename, extension = nil)
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+ </h3><div class="docstring">
1270
+ <div class="discussion">
1271
+
1272
+ <p>Open the file in non-binary, read-only mode, read it and parse it to UTF-8</p>
1273
+
1274
+
1275
+ </div>
1276
+ </div>
1277
+ <div class="tags">
1278
+ <p class="tag_title">Parameters:</p>
1279
+ <ul class="param">
1280
+
1281
+ <li>
1282
+
1283
+ <span class='name'>filename</span>
1284
+
1285
+
1286
+ <span class='type'>(<tt>String</tt>)</span>
1287
+
1288
+
1289
+
1290
+ &mdash;
1291
+ <div class='inline'>
1292
+ <p>a string with a reference to the file to be opened</p>
1293
+ </div>
1294
+
1295
+ </li>
1296
+
1297
+ <li>
1298
+
1299
+ <span class='name'>extension</span>
1300
+
1301
+
1302
+ <span class='type'>(<tt>String</tt>)</span>
1303
+
1304
+
1305
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
1306
+
1307
+
1308
+ &mdash;
1309
+ <div class='inline'>
1310
+ <p>an optional string enforcing a certain parser (based on the file extension,
1311
+ e.g. ‘txt’, ‘csv’ or ‘xls’)</p>
1312
+ </div>
1313
+
1314
+ </li>
1315
+
1316
+ </ul>
1317
+
1318
+
1319
+ </div><table class="source_code">
1320
+ <tr>
1321
+ <td>
1322
+ <pre class="lines">
1323
+
1324
+
1325
+ 103
1326
+ 104
1327
+ 105
1328
+ 106
1329
+ 107
1330
+ 108
1331
+ 109
1332
+ 110</pre>
1333
+ </td>
1334
+ <td>
1335
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 103</span>
1336
+
1337
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_open_text identifier id'>open_text</span> <span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_extension identifier id'>extension</span><span class='assign token'>=</span><span class='rubyid_nil nil kw'>nil</span>
1338
+ <span class='rubyid_extension identifier id'>extension</span> <span class='assign token'>=</span> <span class='rubyid_file_extension identifier id'>file_extension</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='rparen token'>)</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_extension identifier id'>extension</span>
1339
+ <span class='rubyid_f identifier id'>f</span> <span class='assign token'>=</span> <span class='rubyid_File constant id'>File</span><span class='dot token'>.</span><span class='rubyid_open identifier id'>open</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span><span class='string val'>'r'</span><span class='rparen token'>)</span>
1340
+ <span class='rubyid_t identifier id'>t</span> <span class='assign token'>=</span> <span class='rubyid_f identifier id'>f</span><span class='dot token'>.</span><span class='rubyid_read identifier id'>read</span>
1341
+ <span class='rubyid_detected_encoding identifier id'>detected_encoding</span> <span class='assign token'>=</span> <span class='rubyid_CharDet constant id'>CharDet</span><span class='dot token'>.</span><span class='rubyid_detect identifier id'>detect</span><span class='lparen token'>(</span><span class='rubyid_t identifier id'>t</span><span class='rparen token'>)</span><span class='lbrack token'>[</span><span class='string val'>'encoding'</span><span class='rbrack token'>]</span>
1342
+ <span class='rubyid_t identifier id'>t</span> <span class='assign token'>=</span> <span class='rubyid_Iconv constant id'>Iconv</span><span class='dot token'>.</span><span class='rubyid_conv identifier id'>conv</span><span class='lparen token'>(</span><span class='string val'>&quot;UTF-8//TRANSLIT//IGNORE&quot;</span><span class='comma token'>,</span><span class='rubyid_detected_encoding identifier id'>detected_encoding</span><span class='comma token'>,</span><span class='rubyid_t identifier id'>t</span><span class='rparen token'>)</span>
1343
+ <span class='rubyid_send identifier id'>send</span><span class='lparen token'>(</span><span class='dstring node'>&quot;load_#{extension}&quot;</span><span class='dot token'>.</span><span class='rubyid_to_sym identifier id'>to_sym</span><span class='comma token'>,</span><span class='rubyid_t identifier id'>t</span><span class='rparen token'>)</span>
1344
+ <span class='rubyid_end end kw'>end</span>
1345
+ </pre>
1346
+ </td>
1347
+ </tr>
1348
+ </table>
1349
+ </div>
1350
+
1351
+ <div class="method_details ">
1352
+ <h3 class="signature " id="push-instance_method">
1353
+
1354
+ - (<tt>Object</tt>) <strong>push</strong>(sheet = Workbook::Sheet.new)
1355
+
1356
+
1357
+
1358
+
1359
+
1360
+ </h3><div class="docstring">
1361
+ <div class="discussion">
1362
+
1363
+ <p>Push (like in array) a sheet to the workbook (parameter is optional,
1364
+ default is a new sheet)</p>
1365
+
1366
+
1367
+ </div>
1368
+ </div>
1369
+ <div class="tags">
1370
+ <p class="tag_title">Parameters:</p>
1371
+ <ul class="param">
1372
+
1373
+ <li>
1374
+
1375
+ <span class='name'>sheet</span>
1376
+
1377
+
1378
+ <span class='type'>(<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>)</span>
1379
+
1380
+
1381
+ <em class="default">(defaults to: <tt>Workbook::Sheet.new</tt>)</em>
1382
+
1383
+
1384
+ </li>
1385
+
1386
+ </ul>
1387
+
1388
+
1389
+ </div><table class="source_code">
1390
+ <tr>
1391
+ <td>
1392
+ <pre class="lines">
1393
+
1394
+
1395
+ 55
1396
+ 56
1397
+ 57</pre>
1398
+ </td>
1399
+ <td>
1400
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 55</span>
1401
+
1402
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_push identifier id'>push</span> <span class='rubyid_sheet identifier id'>sheet</span><span class='assign token'>=</span><span class='rubyid_Workbook constant id'>Workbook</span><span class='colon2 op'>::</span><span class='rubyid_Sheet constant id'>Sheet</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span>
1403
+ <span class='rubyid_super super kw'>super</span><span class='lparen token'>(</span><span class='rubyid_sheet identifier id'>sheet</span><span class='rparen token'>)</span>
1404
+ <span class='rubyid_end end kw'>end</span>
1405
+ </pre>
1406
+ </td>
1407
+ </tr>
1408
+ </table>
1409
+ </div>
1410
+
1411
+ <div class="method_details ">
1412
+ <h3 class="signature " id="sheet-instance_method">
1413
+
1414
+ - (<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>) <strong>sheet</strong>
1415
+
1416
+
1417
+
1418
+
1419
+
1420
+ </h3><div class="docstring">
1421
+ <div class="discussion">
1422
+
1423
+ <p>Sheet returns the first sheet of a workbook, or an empty one.</p>
1424
+
1425
+
1426
+ </div>
1427
+ </div>
1428
+ <div class="tags">
1429
+
1430
+ <p class="tag_title">Returns:</p>
1431
+ <ul class="return">
1432
+
1433
+ <li>
1434
+
1435
+
1436
+ <span class='type'>(<tt><span class='object_link'><a href="Sheet.html" title="Workbook::Sheet (class)">Workbook::Sheet</a></span></tt>)</span>
1437
+
1438
+
1439
+
1440
+ &mdash;
1441
+ <div class='inline'>
1442
+ <p>The first sheet, and creates an empty one if one doesn’t exists</p>
1443
+ </div>
1444
+
1445
+ </li>
1446
+
1447
+ </ul>
1448
+
1449
+ </div><table class="source_code">
1450
+ <tr>
1451
+ <td>
1452
+ <pre class="lines">
1453
+
1454
+
1455
+ 62
1456
+ 63
1457
+ 64
1458
+ 65</pre>
1459
+ </td>
1460
+ <td>
1461
+ <pre class="code"><span class="info file"># File 'lib/workbook/book.rb', line 62</span>
1462
+
1463
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_sheet identifier id'>sheet</span>
1464
+ <span class='rubyid_push identifier id'>push</span> <span class='rubyid_Workbook constant id'>Workbook</span><span class='colon2 op'>::</span><span class='rubyid_Sheet constant id'>Sheet</span><span class='dot token'>.</span><span class='rubyid_new identifier id'>new</span> <span class='rubyid_unless unless_mod kw'>unless</span> <span class='rubyid_first identifier id'>first</span>
1465
+ <span class='rubyid_first identifier id'>first</span>
1466
+ <span class='rubyid_end end kw'>end</span>
1467
+ </pre>
1468
+ </td>
1469
+ </tr>
1470
+ </table>
1471
+ </div>
1472
+
1473
+ </div>
1474
+
1475
+ </div>
1476
+
1477
+ <div id="footer">
1478
+ Generated on Thu Jan 17 13:16:04 2013 by
1479
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1480
+ 0.8.3 (ruby-1.8.7).
1481
+ </div>
1482
+
1483
+ </body>
1484
+ </html>