dbf 4.1.1 → 4.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +67 -53
  5. data/Guardfile +1 -1
  6. data/LICENSE +1 -1
  7. data/README.md +115 -20
  8. data/bin/dbf +3 -1
  9. data/docs/CNAME +1 -0
  10. data/docs/DBF.html +200 -0
  11. data/docs/DBF/Column.html +947 -0
  12. data/docs/DBF/Column/LengthError.html +124 -0
  13. data/docs/DBF/Column/NameError.html +124 -0
  14. data/docs/DBF/ColumnType.html +115 -0
  15. data/docs/DBF/ColumnType/Base.html +389 -0
  16. data/docs/DBF/ColumnType/Boolean.html +238 -0
  17. data/docs/DBF/ColumnType/Currency.html +238 -0
  18. data/docs/DBF/ColumnType/Date.html +242 -0
  19. data/docs/DBF/ColumnType/DateTime.html +246 -0
  20. data/docs/DBF/ColumnType/Double.html +238 -0
  21. data/docs/DBF/ColumnType/Float.html +238 -0
  22. data/docs/DBF/ColumnType/General.html +238 -0
  23. data/docs/DBF/ColumnType/Memo.html +246 -0
  24. data/docs/DBF/ColumnType/Nil.html +238 -0
  25. data/docs/DBF/ColumnType/Number.html +242 -0
  26. data/docs/DBF/ColumnType/SignedLong.html +238 -0
  27. data/docs/DBF/ColumnType/String.html +240 -0
  28. data/docs/DBF/Database.html +126 -0
  29. data/docs/DBF/Database/Foxpro.html +653 -0
  30. data/docs/DBF/Database/Table.html +346 -0
  31. data/docs/DBF/FileNotFoundError.html +124 -0
  32. data/docs/DBF/Header.html +723 -0
  33. data/docs/DBF/Memo.html +117 -0
  34. data/docs/DBF/Memo/Base.html +485 -0
  35. data/docs/DBF/Memo/Dbase3.html +242 -0
  36. data/docs/DBF/Memo/Dbase4.html +230 -0
  37. data/docs/DBF/Memo/Foxpro.html +268 -0
  38. data/docs/DBF/NoColumnsDefined.html +124 -0
  39. data/docs/DBF/Record.html +773 -0
  40. data/docs/DBF/Schema.html +980 -0
  41. data/docs/DBF/Table.html +1571 -0
  42. data/docs/_index.html +415 -0
  43. data/docs/class_list.html +51 -0
  44. data/docs/css/common.css +1 -0
  45. data/docs/css/full_list.css +58 -0
  46. data/docs/css/style.css +497 -0
  47. data/docs/file.README.html +359 -0
  48. data/docs/file_list.html +56 -0
  49. data/docs/frames.html +17 -0
  50. data/docs/index.html +359 -0
  51. data/docs/js/app.js +314 -0
  52. data/docs/js/full_list.js +216 -0
  53. data/docs/js/jquery.js +4 -0
  54. data/docs/method_list.html +675 -0
  55. data/docs/top-level-namespace.html +110 -0
  56. data/lib/dbf/column.rb +5 -4
  57. data/lib/dbf/column_type.rb +29 -8
  58. data/lib/dbf/database/foxpro.rb +7 -2
  59. data/lib/dbf/header.rb +11 -3
  60. data/lib/dbf/record.rb +5 -5
  61. data/lib/dbf/schema.rb +4 -3
  62. data/lib/dbf/table.rb +32 -12
  63. data/lib/dbf/version.rb +1 -1
  64. data/spec/dbf/column_spec.rb +17 -17
  65. data/spec/dbf/{database_spec.rb → database/foxpro_spec.rb} +0 -0
  66. data/spec/dbf/file_formats_spec.rb +22 -6
  67. data/spec/dbf/record_spec.rb +2 -2
  68. data/spec/dbf/table_spec.rb +8 -0
  69. data/spec/fixtures/dbase_02.dbf +0 -0
  70. data/spec/fixtures/polygon.dbf +0 -0
  71. data/spec/spec_helper.rb +0 -2
  72. metadata +57 -10
  73. data/docs/supported_encodings.csv +0 -60
  74. data/docs/supported_types.markdown +0 -53
@@ -0,0 +1,980 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Module: DBF::Schema
8
+
9
+ &mdash; Documentation by YARD 0.9.26
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="../css/style.css" type="text/css" />
14
+
15
+ <link rel="stylesheet" href="../css/common.css" type="text/css" />
16
+
17
+ <script type="text/javascript">
18
+ pathId = "DBF::Schema";
19
+ relpath = '../';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="../class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="../_index.html">Index (S)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span>
41
+ &raquo;
42
+ <span class="title">Schema</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="../class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Module: DBF::Schema
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+ <dl>
78
+ <dt>Included in:</dt>
79
+ <dd><span class='object_link'><a href="Table.html" title="DBF::Table (class)">Table</a></span></dd>
80
+ </dl>
81
+
82
+
83
+
84
+ <dl>
85
+ <dt>Defined in:</dt>
86
+ <dd>lib/dbf/schema.rb</dd>
87
+ </dl>
88
+
89
+ </div>
90
+
91
+ <h2>Overview</h2><div class="docstring">
92
+ <div class="discussion">
93
+
94
+ <p>The Schema module is mixin for the Table class</p>
95
+
96
+
97
+ </div>
98
+ </div>
99
+ <div class="tags">
100
+
101
+
102
+ </div>
103
+
104
+ <h2>
105
+ Constant Summary
106
+ <small><a href="#" class="constants_summary_toggle">collapse</a></small>
107
+ </h2>
108
+
109
+ <dl class="constants">
110
+
111
+ <dt id="FORMATS-constant" class="">FORMATS =
112
+
113
+ </dt>
114
+ <dd><pre class="code"><span class='lbracket'>[</span><span class='symbol'>:activerecord</span><span class='comma'>,</span> <span class='symbol'>:json</span><span class='comma'>,</span> <span class='symbol'>:sequel</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
115
+
116
+ <dt id="OTHER_DATA_TYPES-constant" class="">OTHER_DATA_TYPES =
117
+
118
+ </dt>
119
+ <dd><pre class="code"><span class='lbrace'>{</span>
120
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>Y</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:decimal, :precision =&gt; 15, :scale =&gt; 4</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
121
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>D</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:date</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
122
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>T</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:datetime</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
123
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>L</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:boolean</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
124
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>M</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:text</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span>
125
+ <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>B</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:binary</span><span class='tstring_end'>&#39;</span></span>
126
+ <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
127
+
128
+ </dl>
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+ <h2>
139
+ Instance Method Summary
140
+ <small><a href="#" class="summary_toggle">collapse</a></small>
141
+ </h2>
142
+
143
+ <ul class="summary">
144
+
145
+ <li class="public ">
146
+ <span class="summary_signature">
147
+
148
+ <a href="#activerecord_schema-instance_method" title="#activerecord_schema (instance method)">#<strong>activerecord_schema</strong>(_table_only = false) &#x21d2; Object </a>
149
+
150
+
151
+
152
+ </span>
153
+
154
+
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+ <span class="summary_desc"><div class='inline'>
163
+ <p>:nodoc:.</p>
164
+ </div></span>
165
+
166
+ </li>
167
+
168
+
169
+ <li class="public ">
170
+ <span class="summary_signature">
171
+
172
+ <a href="#activerecord_schema_definition-instance_method" title="#activerecord_schema_definition (instance method)">#<strong>activerecord_schema_definition</strong>(column) &#x21d2; String </a>
173
+
174
+
175
+
176
+ </span>
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ <span class="summary_desc"><div class='inline'>
187
+ <p>ActiveRecord schema definition.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ <li class="public ">
194
+ <span class="summary_signature">
195
+
196
+ <a href="#json_schema-instance_method" title="#json_schema (instance method)">#<strong>json_schema</strong>(_table_only = false) &#x21d2; Object </a>
197
+
198
+
199
+
200
+ </span>
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+ <span class="summary_desc"><div class='inline'>
211
+ <p>:nodoc:.</p>
212
+ </div></span>
213
+
214
+ </li>
215
+
216
+
217
+ <li class="public ">
218
+ <span class="summary_signature">
219
+
220
+ <a href="#number_data_type-instance_method" title="#number_data_type (instance method)">#<strong>number_data_type</strong>(column) &#x21d2; Object </a>
221
+
222
+
223
+
224
+ </span>
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+ <span class="summary_desc"><div class='inline'></div></span>
235
+
236
+ </li>
237
+
238
+
239
+ <li class="public ">
240
+ <span class="summary_signature">
241
+
242
+ <a href="#schema-instance_method" title="#schema (instance method)">#<strong>schema</strong>(format = :activerecord, table_only = false) &#x21d2; String </a>
243
+
244
+
245
+
246
+ </span>
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+ <span class="summary_desc"><div class='inline'>
257
+ <p>Generate an ActiveRecord::Schema.</p>
258
+ </div></span>
259
+
260
+ </li>
261
+
262
+
263
+ <li class="public ">
264
+ <span class="summary_signature">
265
+
266
+ <a href="#schema_data_type-instance_method" title="#schema_data_type (instance method)">#<strong>schema_data_type</strong>(column, format = :activerecord) &#x21d2; Object </a>
267
+
268
+
269
+
270
+ </span>
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+ <span class="summary_desc"><div class='inline'>
281
+ <p>:nodoc:.</p>
282
+ </div></span>
283
+
284
+ </li>
285
+
286
+
287
+ <li class="public ">
288
+ <span class="summary_signature">
289
+
290
+ <a href="#schema_name-instance_method" title="#schema_name (instance method)">#<strong>schema_name</strong>(format) &#x21d2; Object </a>
291
+
292
+
293
+
294
+ </span>
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+ <span class="summary_desc"><div class='inline'>
305
+ <p>:nodoc:.</p>
306
+ </div></span>
307
+
308
+ </li>
309
+
310
+
311
+ <li class="public ">
312
+ <span class="summary_signature">
313
+
314
+ <a href="#sequel_schema-instance_method" title="#sequel_schema (instance method)">#<strong>sequel_schema</strong>(table_only = false) &#x21d2; Object </a>
315
+
316
+
317
+
318
+ </span>
319
+
320
+
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+ <span class="summary_desc"><div class='inline'>
329
+ <p>:nodoc:.</p>
330
+ </div></span>
331
+
332
+ </li>
333
+
334
+
335
+ <li class="public ">
336
+ <span class="summary_signature">
337
+
338
+ <a href="#sequel_schema_definition-instance_method" title="#sequel_schema_definition (instance method)">#<strong>sequel_schema_definition</strong>(column) &#x21d2; String </a>
339
+
340
+
341
+
342
+ </span>
343
+
344
+
345
+
346
+
347
+
348
+
349
+
350
+
351
+
352
+ <span class="summary_desc"><div class='inline'>
353
+ <p>Sequel schema definition.</p>
354
+ </div></span>
355
+
356
+ </li>
357
+
358
+
359
+ <li class="public ">
360
+ <span class="summary_signature">
361
+
362
+ <a href="#string_data_format-instance_method" title="#string_data_format (instance method)">#<strong>string_data_format</strong>(format, column) &#x21d2; Object </a>
363
+
364
+
365
+
366
+ </span>
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+ <span class="summary_desc"><div class='inline'></div></span>
377
+
378
+ </li>
379
+
380
+
381
+ </ul>
382
+
383
+
384
+
385
+
386
+ <div id="instance_method_details" class="method_details_list">
387
+ <h2>Instance Method Details</h2>
388
+
389
+
390
+ <div class="method_details first">
391
+ <h3 class="signature first" id="activerecord_schema-instance_method">
392
+
393
+ #<strong>activerecord_schema</strong>(_table_only = false) &#x21d2; <tt>Object</tt>
394
+
395
+
396
+
397
+
398
+
399
+ </h3><div class="docstring">
400
+ <div class="discussion">
401
+
402
+ <p>:nodoc:</p>
403
+
404
+
405
+ </div>
406
+ </div>
407
+ <div class="tags">
408
+
409
+
410
+ </div><table class="source_code">
411
+ <tr>
412
+ <td>
413
+ <pre class="lines">
414
+
415
+
416
+ 49
417
+ 50
418
+ 51
419
+ 52
420
+ 53
421
+ 54
422
+ 55
423
+ 56
424
+ 57</pre>
425
+ </td>
426
+ <td>
427
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 49</span>
428
+
429
+ <span class='kw'>def</span> <span class='id identifier rubyid_activerecord_schema'>activerecord_schema</span><span class='lparen'>(</span><span class='id identifier rubyid__table_only'>_table_only</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
430
+ </span> <span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>ActiveRecord::Schema.define do\n</span><span class='tstring_end'>&quot;</span></span>
431
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> create_table \&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot; do |t|\n</span><span class='tstring_end'>&quot;</span></span>
432
+ <span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_column'>column</span><span class='op'>|</span>
433
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> t.column </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_activerecord_schema_definition'>activerecord_schema_definition</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
434
+ <span class='kw'>end</span>
435
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> end\nend</span><span class='tstring_end'>&quot;</span></span>
436
+ <span class='id identifier rubyid_s'>s</span>
437
+ <span class='kw'>end</span></pre>
438
+ </td>
439
+ </tr>
440
+ </table>
441
+ </div>
442
+
443
+ <div class="method_details ">
444
+ <h3 class="signature " id="activerecord_schema_definition-instance_method">
445
+
446
+ #<strong>activerecord_schema_definition</strong>(column) &#x21d2; <tt>String</tt>
447
+
448
+
449
+
450
+
451
+
452
+ </h3><div class="docstring">
453
+ <div class="discussion">
454
+
455
+ <p>ActiveRecord schema definition</p>
456
+
457
+
458
+ </div>
459
+ </div>
460
+ <div class="tags">
461
+ <p class="tag_title">Parameters:</p>
462
+ <ul class="param">
463
+
464
+ <li>
465
+
466
+ <span class='name'>column</span>
467
+
468
+
469
+ <span class='type'>(<tt><span class='object_link'><a href="Column.html" title="DBF::Column (class)">DBF::Column</a></span></tt>)</span>
470
+
471
+
472
+
473
+ </li>
474
+
475
+ </ul>
476
+
477
+ <p class="tag_title">Returns:</p>
478
+ <ul class="return">
479
+
480
+ <li>
481
+
482
+
483
+ <span class='type'>(<tt>String</tt>)</span>
484
+
485
+
486
+
487
+ </li>
488
+
489
+ </ul>
490
+
491
+ </div><table class="source_code">
492
+ <tr>
493
+ <td>
494
+ <pre class="lines">
495
+
496
+
497
+ 81
498
+ 82
499
+ 83</pre>
500
+ </td>
501
+ <td>
502
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 81</span>
503
+
504
+ <span class='kw'>def</span> <span class='id identifier rubyid_activerecord_schema_definition'>activerecord_schema_definition</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
505
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_underscored_name'>underscored_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>\&quot;, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_schema_data_type'>schema_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='comma'>,</span> <span class='symbol'>:activerecord</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
506
+ <span class='kw'>end</span></pre>
507
+ </td>
508
+ </tr>
509
+ </table>
510
+ </div>
511
+
512
+ <div class="method_details ">
513
+ <h3 class="signature " id="json_schema-instance_method">
514
+
515
+ #<strong>json_schema</strong>(_table_only = false) &#x21d2; <tt>Object</tt>
516
+
517
+
518
+
519
+
520
+
521
+ </h3><div class="docstring">
522
+ <div class="discussion">
523
+
524
+ <p>:nodoc:</p>
525
+
526
+
527
+ </div>
528
+ </div>
529
+ <div class="tags">
530
+
531
+
532
+ </div><table class="source_code">
533
+ <tr>
534
+ <td>
535
+ <pre class="lines">
536
+
537
+
538
+ 73
539
+ 74
540
+ 75</pre>
541
+ </td>
542
+ <td>
543
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 73</span>
544
+
545
+ <span class='kw'>def</span> <span class='id identifier rubyid_json_schema'>json_schema</span><span class='lparen'>(</span><span class='id identifier rubyid__table_only'>_table_only</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
546
+ </span> <span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lparen'>(</span><span class='op'>&amp;</span><span class='symbol'>:to_hash</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span>
547
+ <span class='kw'>end</span></pre>
548
+ </td>
549
+ </tr>
550
+ </table>
551
+ </div>
552
+
553
+ <div class="method_details ">
554
+ <h3 class="signature " id="number_data_type-instance_method">
555
+
556
+ #<strong>number_data_type</strong>(column) &#x21d2; <tt>Object</tt>
557
+
558
+
559
+
560
+
561
+
562
+ </h3><table class="source_code">
563
+ <tr>
564
+ <td>
565
+ <pre class="lines">
566
+
567
+
568
+ 104
569
+ 105
570
+ 106</pre>
571
+ </td>
572
+ <td>
573
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 104</span>
574
+
575
+ <span class='kw'>def</span> <span class='id identifier rubyid_number_data_type'>number_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
576
+ <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_decimal'>decimal</span> <span class='op'>&gt;</span> <span class='int'>0</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:float</span><span class='tstring_end'>&#39;</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:integer</span><span class='tstring_end'>&#39;</span></span>
577
+ <span class='kw'>end</span></pre>
578
+ </td>
579
+ </tr>
580
+ </table>
581
+ </div>
582
+
583
+ <div class="method_details ">
584
+ <h3 class="signature " id="schema-instance_method">
585
+
586
+ #<strong>schema</strong>(format = :activerecord, table_only = false) &#x21d2; <tt>String</tt>
587
+
588
+
589
+
590
+
591
+
592
+ </h3><div class="docstring">
593
+ <div class="discussion">
594
+
595
+ <p>Generate an ActiveRecord::Schema</p>
596
+
597
+ <p>xBase data types are converted to generic types as follows:</p>
598
+ <ul><li>
599
+ <p>Number columns with no decimals are converted to :integer</p>
600
+ </li><li>
601
+ <p>Number columns with decimals are converted to :float</p>
602
+ </li><li>
603
+ <p>Date columns are converted to :datetime</p>
604
+ </li><li>
605
+ <p>Logical columns are converted to :boolean</p>
606
+ </li><li>
607
+ <p>Memo columns are converted to :text</p>
608
+ </li><li>
609
+ <p>Character columns are converted to :string and the :limit option is set to the length of the character column</p>
610
+ </li></ul>
611
+
612
+ <p>Example:</p>
613
+
614
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_create_table'>create_table</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>mydata</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span>
615
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_column'>column</span> <span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:string</span><span class='comma'>,</span> <span class='symbol'>:limit</span> <span class='op'>=&gt;</span> <span class='int'>30</span>
616
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_column'>column</span> <span class='symbol'>:last_update</span><span class='comma'>,</span> <span class='symbol'>:datetime</span>
617
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_column'>column</span> <span class='symbol'>:is_active</span><span class='comma'>,</span> <span class='symbol'>:boolean</span>
618
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_column'>column</span> <span class='symbol'>:age</span><span class='comma'>,</span> <span class='symbol'>:integer</span>
619
+ <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_column'>column</span> <span class='symbol'>:notes</span><span class='comma'>,</span> <span class='symbol'>:text</span>
620
+ <span class='kw'>end</span>
621
+ </code></pre>
622
+
623
+
624
+ </div>
625
+ </div>
626
+ <div class="tags">
627
+ <p class="tag_title">Parameters:</p>
628
+ <ul class="param">
629
+
630
+ <li>
631
+
632
+ <span class='name'>format</span>
633
+
634
+
635
+ <span class='type'>(<tt>Symbol</tt>)</span>
636
+
637
+
638
+ <em class="default">(defaults to: <tt>:activerecord</tt>)</em>
639
+
640
+
641
+ &mdash;
642
+ <div class='inline'>
643
+ <p>format Valid options are :activerecord and :json</p>
644
+ </div>
645
+
646
+ </li>
647
+
648
+ <li>
649
+
650
+ <span class='name'>table_only</span>
651
+
652
+
653
+ <span class='type'>(<tt>Boolean</tt>)</span>
654
+
655
+
656
+ <em class="default">(defaults to: <tt>false</tt>)</em>
657
+
658
+
659
+ </li>
660
+
661
+ </ul>
662
+
663
+ <p class="tag_title">Returns:</p>
664
+ <ul class="return">
665
+
666
+ <li>
667
+
668
+
669
+ <span class='type'>(<tt>String</tt>)</span>
670
+
671
+
672
+
673
+ </li>
674
+
675
+ </ul>
676
+
677
+ </div><table class="source_code">
678
+ <tr>
679
+ <td>
680
+ <pre class="lines">
681
+
682
+
683
+ 38
684
+ 39
685
+ 40
686
+ 41
687
+ 42
688
+ 43</pre>
689
+ </td>
690
+ <td>
691
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 38</span>
692
+
693
+ <span class='kw'>def</span> <span class='id identifier rubyid_schema'>schema</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='symbol'>:activerecord</span><span class='comma'>,</span> <span class='id identifier rubyid_table_only'>table_only</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
694
+ <span class='id identifier rubyid_schema_method_name'>schema_method_name</span> <span class='op'>=</span> <span class='id identifier rubyid_schema_name'>schema_name</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span>
695
+ <span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_schema_method_name'>schema_method_name</span><span class='comma'>,</span> <span class='id identifier rubyid_table_only'>table_only</span><span class='rparen'>)</span>
696
+ <span class='kw'>rescue</span> <span class='const'>NameError</span>
697
+ <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_content'> is not a valid schema. Valid schemas are: </span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#FORMATS-constant" title="DBF::Schema::FORMATS (constant)">FORMATS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>, </span><span class='tstring_end'>&#39;</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>&quot;</span></span>
698
+ <span class='kw'>end</span></pre>
699
+ </td>
700
+ </tr>
701
+ </table>
702
+ </div>
703
+
704
+ <div class="method_details ">
705
+ <h3 class="signature " id="schema_data_type-instance_method">
706
+
707
+ #<strong>schema_data_type</strong>(column, format = :activerecord) &#x21d2; <tt>Object</tt>
708
+
709
+
710
+
711
+
712
+
713
+ </h3><div class="docstring">
714
+ <div class="discussion">
715
+
716
+ <p>:nodoc:</p>
717
+
718
+
719
+ </div>
720
+ </div>
721
+ <div class="tags">
722
+
723
+
724
+ </div><table class="source_code">
725
+ <tr>
726
+ <td>
727
+ <pre class="lines">
728
+
729
+
730
+ 93
731
+ 94
732
+ 95
733
+ 96
734
+ 97
735
+ 98
736
+ 99
737
+ 100
738
+ 101
739
+ 102</pre>
740
+ </td>
741
+ <td>
742
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 93</span>
743
+
744
+ <span class='kw'>def</span> <span class='id identifier rubyid_schema_data_type'>schema_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='symbol'>:activerecord</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
745
+ </span> <span class='kw'>case</span> <span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span>
746
+ <span class='kw'>when</span> <span class='op'>*</span><span class='qwords_beg'>%w[</span><span class='tstring_content'>N</span><span class='words_sep'> </span><span class='tstring_content'>F</span><span class='words_sep'> </span><span class='tstring_content'>I</span><span class='tstring_end'>]</span></span>
747
+ <span class='id identifier rubyid_number_data_type'>number_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
748
+ <span class='kw'>when</span> <span class='op'>*</span><span class='qwords_beg'>%w[</span><span class='tstring_content'>Y</span><span class='words_sep'> </span><span class='tstring_content'>D</span><span class='words_sep'> </span><span class='tstring_content'>T</span><span class='words_sep'> </span><span class='tstring_content'>L</span><span class='words_sep'> </span><span class='tstring_content'>M</span><span class='words_sep'> </span><span class='tstring_content'>B</span><span class='tstring_end'>]</span></span>
749
+ <span class='const'><span class='object_link'><a href="#OTHER_DATA_TYPES-constant" title="DBF::Schema::OTHER_DATA_TYPES (constant)">OTHER_DATA_TYPES</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='rbracket'>]</span>
750
+ <span class='kw'>else</span>
751
+ <span class='id identifier rubyid_string_data_format'>string_data_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='comma'>,</span> <span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
752
+ <span class='kw'>end</span>
753
+ <span class='kw'>end</span></pre>
754
+ </td>
755
+ </tr>
756
+ </table>
757
+ </div>
758
+
759
+ <div class="method_details ">
760
+ <h3 class="signature " id="schema_name-instance_method">
761
+
762
+ #<strong>schema_name</strong>(format) &#x21d2; <tt>Object</tt>
763
+
764
+
765
+
766
+
767
+
768
+ </h3><div class="docstring">
769
+ <div class="discussion">
770
+
771
+ <p>:nodoc:</p>
772
+
773
+
774
+ </div>
775
+ </div>
776
+ <div class="tags">
777
+
778
+
779
+ </div><table class="source_code">
780
+ <tr>
781
+ <td>
782
+ <pre class="lines">
783
+
784
+
785
+ 45
786
+ 46
787
+ 47</pre>
788
+ </td>
789
+ <td>
790
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 45</span>
791
+
792
+ <span class='kw'>def</span> <span class='id identifier rubyid_schema_name'>schema_name</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
793
+ </span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_format'>format</span><span class='embexpr_end'>}</span><span class='tstring_content'>_schema</span><span class='tstring_end'>&quot;</span></span>
794
+ <span class='kw'>end</span></pre>
795
+ </td>
796
+ </tr>
797
+ </table>
798
+ </div>
799
+
800
+ <div class="method_details ">
801
+ <h3 class="signature " id="sequel_schema-instance_method">
802
+
803
+ #<strong>sequel_schema</strong>(table_only = false) &#x21d2; <tt>Object</tt>
804
+
805
+
806
+
807
+
808
+
809
+ </h3><div class="docstring">
810
+ <div class="discussion">
811
+
812
+ <p>:nodoc:</p>
813
+
814
+
815
+ </div>
816
+ </div>
817
+ <div class="tags">
818
+
819
+
820
+ </div><table class="source_code">
821
+ <tr>
822
+ <td>
823
+ <pre class="lines">
824
+
825
+
826
+ 59
827
+ 60
828
+ 61
829
+ 62
830
+ 63
831
+ 64
832
+ 65
833
+ 66
834
+ 67
835
+ 68
836
+ 69
837
+ 70
838
+ 71</pre>
839
+ </td>
840
+ <td>
841
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 59</span>
842
+
843
+ <span class='kw'>def</span> <span class='id identifier rubyid_sequel_schema'>sequel_schema</span><span class='lparen'>(</span><span class='id identifier rubyid_table_only'>table_only</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='comment'># :nodoc:
844
+ </span> <span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_end'>&#39;</span></span>
845
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Sequel.migration do\n</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_table_only'>table_only</span>
846
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> change do\n </span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_table_only'>table_only</span>
847
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> create_table(:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'>) do\n</span><span class='tstring_end'>&quot;</span></span>
848
+ <span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_column'>column</span><span class='op'>|</span>
849
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> column </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sequel_schema_definition'>sequel_schema_definition</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
850
+ <span class='kw'>end</span>
851
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> end\n</span><span class='tstring_end'>&quot;</span></span>
852
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> end\n</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_table_only'>table_only</span>
853
+ <span class='id identifier rubyid_s'>s</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>end\n</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_table_only'>table_only</span>
854
+ <span class='id identifier rubyid_s'>s</span>
855
+ <span class='kw'>end</span></pre>
856
+ </td>
857
+ </tr>
858
+ </table>
859
+ </div>
860
+
861
+ <div class="method_details ">
862
+ <h3 class="signature " id="sequel_schema_definition-instance_method">
863
+
864
+ #<strong>sequel_schema_definition</strong>(column) &#x21d2; <tt>String</tt>
865
+
866
+
867
+
868
+
869
+
870
+ </h3><div class="docstring">
871
+ <div class="discussion">
872
+
873
+ <p>Sequel schema definition</p>
874
+
875
+
876
+ </div>
877
+ </div>
878
+ <div class="tags">
879
+ <p class="tag_title">Parameters:</p>
880
+ <ul class="param">
881
+
882
+ <li>
883
+
884
+ <span class='name'>column</span>
885
+
886
+
887
+ <span class='type'>(<tt><span class='object_link'><a href="Column.html" title="DBF::Column (class)">DBF::Column</a></span></tt>)</span>
888
+
889
+
890
+
891
+ </li>
892
+
893
+ </ul>
894
+
895
+ <p class="tag_title">Returns:</p>
896
+ <ul class="return">
897
+
898
+ <li>
899
+
900
+
901
+ <span class='type'>(<tt>String</tt>)</span>
902
+
903
+
904
+
905
+ </li>
906
+
907
+ </ul>
908
+
909
+ </div><table class="source_code">
910
+ <tr>
911
+ <td>
912
+ <pre class="lines">
913
+
914
+
915
+ 89
916
+ 90
917
+ 91</pre>
918
+ </td>
919
+ <td>
920
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 89</span>
921
+
922
+ <span class='kw'>def</span> <span class='id identifier rubyid_sequel_schema_definition'>sequel_schema_definition</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
923
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_underscored_name'>underscored_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>, </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_schema_data_type'>schema_data_type</span><span class='lparen'>(</span><span class='id identifier rubyid_column'>column</span><span class='comma'>,</span> <span class='symbol'>:sequel</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>\n</span><span class='tstring_end'>&quot;</span></span>
924
+ <span class='kw'>end</span></pre>
925
+ </td>
926
+ </tr>
927
+ </table>
928
+ </div>
929
+
930
+ <div class="method_details ">
931
+ <h3 class="signature " id="string_data_format-instance_method">
932
+
933
+ #<strong>string_data_format</strong>(format, column) &#x21d2; <tt>Object</tt>
934
+
935
+
936
+
937
+
938
+
939
+ </h3><table class="source_code">
940
+ <tr>
941
+ <td>
942
+ <pre class="lines">
943
+
944
+
945
+ 108
946
+ 109
947
+ 110
948
+ 111
949
+ 112
950
+ 113
951
+ 114</pre>
952
+ </td>
953
+ <td>
954
+ <pre class="code"><span class="info file"># File 'lib/dbf/schema.rb', line 108</span>
955
+
956
+ <span class='kw'>def</span> <span class='id identifier rubyid_string_data_format'>string_data_format</span><span class='lparen'>(</span><span class='id identifier rubyid_format'>format</span><span class='comma'>,</span> <span class='id identifier rubyid_column'>column</span><span class='rparen'>)</span>
957
+ <span class='kw'>if</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>==</span> <span class='symbol'>:sequel</span>
958
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:varchar, :size =&gt; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
959
+ <span class='kw'>else</span>
960
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>:string, :limit =&gt; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_column'>column</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span>
961
+ <span class='kw'>end</span>
962
+ <span class='kw'>end</span></pre>
963
+ </td>
964
+ </tr>
965
+ </table>
966
+ </div>
967
+
968
+ </div>
969
+
970
+ </div>
971
+
972
+ <div id="footer">
973
+ Generated on Sun Aug 8 16:19:08 2021 by
974
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
975
+ 0.9.26 (ruby-3.0.1).
976
+ </div>
977
+
978
+ </div>
979
+ </body>
980
+ </html>