dbf 4.0.1 → 4.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +68 -54
- data/Guardfile +1 -1
- data/LICENSE +1 -1
- data/README.md +115 -20
- data/bin/dbf +1 -1
- data/dbf.gemspec +1 -0
- data/docs/CNAME +1 -0
- data/docs/DBF.html +200 -0
- data/docs/DBF/Column.html +947 -0
- data/docs/DBF/Column/LengthError.html +124 -0
- data/docs/DBF/Column/NameError.html +124 -0
- data/docs/DBF/ColumnType.html +115 -0
- data/docs/DBF/ColumnType/Base.html +389 -0
- data/docs/DBF/ColumnType/Boolean.html +238 -0
- data/docs/DBF/ColumnType/Currency.html +238 -0
- data/docs/DBF/ColumnType/Date.html +242 -0
- data/docs/DBF/ColumnType/DateTime.html +246 -0
- data/docs/DBF/ColumnType/Double.html +238 -0
- data/docs/DBF/ColumnType/Float.html +238 -0
- data/docs/DBF/ColumnType/General.html +238 -0
- data/docs/DBF/ColumnType/Memo.html +246 -0
- data/docs/DBF/ColumnType/Nil.html +238 -0
- data/docs/DBF/ColumnType/Number.html +242 -0
- data/docs/DBF/ColumnType/SignedLong.html +238 -0
- data/docs/DBF/ColumnType/String.html +240 -0
- data/docs/DBF/Database.html +126 -0
- data/docs/DBF/Database/Foxpro.html +653 -0
- data/docs/DBF/Database/Table.html +346 -0
- data/docs/DBF/FileNotFoundError.html +124 -0
- data/docs/DBF/Header.html +723 -0
- data/docs/DBF/Memo.html +117 -0
- data/docs/DBF/Memo/Base.html +485 -0
- data/docs/DBF/Memo/Dbase3.html +242 -0
- data/docs/DBF/Memo/Dbase4.html +230 -0
- data/docs/DBF/Memo/Foxpro.html +268 -0
- data/docs/DBF/NoColumnsDefined.html +124 -0
- data/docs/DBF/Record.html +773 -0
- data/docs/DBF/Schema.html +980 -0
- data/docs/DBF/Table.html +1571 -0
- data/docs/_index.html +415 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +497 -0
- data/docs/file.README.html +359 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +359 -0
- data/docs/js/app.js +314 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +675 -0
- data/docs/top-level-namespace.html +110 -0
- data/lib/dbf/column.rb +5 -4
- data/lib/dbf/column_type.rb +29 -8
- data/lib/dbf/database/foxpro.rb +7 -2
- data/lib/dbf/header.rb +11 -3
- data/lib/dbf/record.rb +5 -5
- data/lib/dbf/schema.rb +4 -3
- data/lib/dbf/table.rb +32 -12
- data/lib/dbf/version.rb +1 -1
- data/spec/dbf/column_spec.rb +17 -17
- data/spec/dbf/{database_spec.rb → database/foxpro_spec.rb} +0 -0
- data/spec/dbf/file_formats_spec.rb +22 -6
- data/spec/dbf/record_spec.rb +2 -2
- data/spec/dbf/table_spec.rb +8 -0
- data/spec/fixtures/dbase_02.dbf +0 -0
- data/spec/fixtures/polygon.dbf +0 -0
- data/spec/spec_helper.rb +0 -2
- metadata +59 -12
- data/docs/supported_encodings.csv +0 -60
- data/docs/supported_types.markdown +0 -53
data/docs/DBF/Table.html
ADDED
@@ -0,0 +1,1571 @@
|
|
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
|
+
Class: DBF::Table
|
8
|
+
|
9
|
+
— 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::Table";
|
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 (T)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Table</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>Class: DBF::Table
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">DBF::Table</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
<dl>
|
89
|
+
<dt>Extended by:</dt>
|
90
|
+
<dd>Forwardable</dd>
|
91
|
+
</dl>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Includes:</dt>
|
97
|
+
<dd><span class='object_link'><a href="Schema.html" title="DBF::Schema (module)">Schema</a></span>, Enumerable</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<dl>
|
106
|
+
<dt>Defined in:</dt>
|
107
|
+
<dd>lib/dbf/table.rb</dd>
|
108
|
+
</dl>
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
<h2>Overview</h2><div class="docstring">
|
113
|
+
<div class="discussion">
|
114
|
+
|
115
|
+
<p>DBF::Table is the primary interface to a single DBF file and provides methods for enumerating and searching the records.</p>
|
116
|
+
|
117
|
+
|
118
|
+
</div>
|
119
|
+
</div>
|
120
|
+
<div class="tags">
|
121
|
+
|
122
|
+
|
123
|
+
</div><div id="subclasses">
|
124
|
+
<h2>Direct Known Subclasses</h2>
|
125
|
+
<p class="children"><span class='object_link'><a href="Database/Table.html" title="DBF::Database::Table (class)">Database::Table</a></span></p>
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
<h2>
|
130
|
+
Constant Summary
|
131
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
132
|
+
</h2>
|
133
|
+
|
134
|
+
<dl class="constants">
|
135
|
+
|
136
|
+
<dt id="DBASE2_HEADER_SIZE-constant" class="">DBASE2_HEADER_SIZE =
|
137
|
+
|
138
|
+
</dt>
|
139
|
+
<dd><pre class="code"><span class='int'>8</span></pre></dd>
|
140
|
+
|
141
|
+
<dt id="DBASE3_HEADER_SIZE-constant" class="">DBASE3_HEADER_SIZE =
|
142
|
+
|
143
|
+
</dt>
|
144
|
+
<dd><pre class="code"><span class='int'>32</span></pre></dd>
|
145
|
+
|
146
|
+
<dt id="VERSIONS-constant" class="">VERSIONS =
|
147
|
+
|
148
|
+
</dt>
|
149
|
+
<dd><pre class="code"><span class='lbrace'>{</span>
|
150
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>02</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>FoxBase</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
151
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>03</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBase III without memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
152
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>04</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBase IV without memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
153
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>05</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBase V without memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
154
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>07</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Visual Objects 1.x</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
155
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>30</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Visual FoxPro</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
156
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>31</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Visual FoxPro with AutoIncrement field</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
157
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>43</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBASE IV SQL table files, no memo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
158
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>63</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBASE IV SQL system files, no memo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
159
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>7b</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBase IV with memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
160
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>83</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBase III with memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
161
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>87</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Visual Objects 1.x with memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
162
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>8b</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBase IV with memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
163
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>8e</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBase IV with SQL table</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
164
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cb</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>dBASE IV SQL table files, with memo</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
165
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>f5</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>FoxPro with memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
166
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fb</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>FoxPro without memo file</span><span class='tstring_end'>'</span></span>
|
167
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
168
|
+
|
169
|
+
<dt id="FOXPRO_VERSIONS-constant" class="">FOXPRO_VERSIONS =
|
170
|
+
|
171
|
+
</dt>
|
172
|
+
<dd><pre class="code"><span class='lbrace'>{</span>
|
173
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>30</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Visual FoxPro</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
174
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>31</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Visual FoxPro with AutoIncrement field</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
175
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>f5</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>FoxPro with memo file</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
176
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>fb</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>FoxPro without memo file</span><span class='tstring_end'>'</span></span>
|
177
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
178
|
+
|
179
|
+
</dl>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
<h3 class="inherited">Constants included
|
187
|
+
from <span class='object_link'><a href="Schema.html" title="DBF::Schema (module)">Schema</a></span></h3>
|
188
|
+
<p class="inherited"><span class='object_link'><a href="Schema.html#FORMATS-constant" title="DBF::Schema::FORMATS (constant)">Schema::FORMATS</a></span>, <span class='object_link'><a href="Schema.html#OTHER_DATA_TYPES-constant" title="DBF::Schema::OTHER_DATA_TYPES (constant)">Schema::OTHER_DATA_TYPES</a></span></p>
|
189
|
+
|
190
|
+
|
191
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
192
|
+
<ul class="summary">
|
193
|
+
|
194
|
+
<li class="public ">
|
195
|
+
<span class="summary_signature">
|
196
|
+
|
197
|
+
<a href="#encoding-instance_method" title="#encoding (instance method)">#<strong>encoding</strong> ⇒ Object </a>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<span class="summary_desc"><div class='inline'>
|
215
|
+
<p>Returns the value of attribute encoding.</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
<li class="public ">
|
222
|
+
<span class="summary_signature">
|
223
|
+
|
224
|
+
<a href="#name-instance_method" title="#name (instance method)">#<strong>name</strong> ⇒ String </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
242
|
+
|
243
|
+
</li>
|
244
|
+
|
245
|
+
|
246
|
+
</ul>
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
<h2>
|
253
|
+
Instance Method Summary
|
254
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
255
|
+
</h2>
|
256
|
+
|
257
|
+
<ul class="summary">
|
258
|
+
|
259
|
+
<li class="public ">
|
260
|
+
<span class="summary_signature">
|
261
|
+
|
262
|
+
<a href="#close-instance_method" title="#close (instance method)">#<strong>close</strong> ⇒ TrueClass, FalseClass </a>
|
263
|
+
|
264
|
+
|
265
|
+
|
266
|
+
</span>
|
267
|
+
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
<span class="summary_desc"><div class='inline'>
|
277
|
+
<p>Closes the table and memo file.</p>
|
278
|
+
</div></span>
|
279
|
+
|
280
|
+
</li>
|
281
|
+
|
282
|
+
|
283
|
+
<li class="public ">
|
284
|
+
<span class="summary_signature">
|
285
|
+
|
286
|
+
<a href="#closed%3F-instance_method" title="#closed? (instance method)">#<strong>closed?</strong> ⇒ TrueClass, FalseClass </a>
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
</span>
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
301
|
+
|
302
|
+
</li>
|
303
|
+
|
304
|
+
|
305
|
+
<li class="public ">
|
306
|
+
<span class="summary_signature">
|
307
|
+
|
308
|
+
<a href="#column_names-instance_method" title="#column_names (instance method)">#<strong>column_names</strong> ⇒ String </a>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
</span>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<span class="summary_desc"><div class='inline'>
|
323
|
+
<p>Column names.</p>
|
324
|
+
</div></span>
|
325
|
+
|
326
|
+
</li>
|
327
|
+
|
328
|
+
|
329
|
+
<li class="public ">
|
330
|
+
<span class="summary_signature">
|
331
|
+
|
332
|
+
<a href="#columns-instance_method" title="#columns (instance method)">#<strong>columns</strong> ⇒ Array </a>
|
333
|
+
|
334
|
+
|
335
|
+
|
336
|
+
</span>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
<span class="summary_desc"><div class='inline'>
|
347
|
+
<p>All columns.</p>
|
348
|
+
</div></span>
|
349
|
+
|
350
|
+
</li>
|
351
|
+
|
352
|
+
|
353
|
+
<li class="public ">
|
354
|
+
<span class="summary_signature">
|
355
|
+
|
356
|
+
<a href="#each-instance_method" title="#each (instance method)">#<strong>each</strong> {|nil, DBF::Record| ... } ⇒ Object </a>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</span>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
<span class="summary_desc"><div class='inline'>
|
371
|
+
<p>Calls block once for each record in the table.</p>
|
372
|
+
</div></span>
|
373
|
+
|
374
|
+
</li>
|
375
|
+
|
376
|
+
|
377
|
+
<li class="public ">
|
378
|
+
<span class="summary_signature">
|
379
|
+
|
380
|
+
<a href="#filename-instance_method" title="#filename (instance method)">#<strong>filename</strong> ⇒ String </a>
|
381
|
+
|
382
|
+
|
383
|
+
|
384
|
+
</span>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
395
|
+
|
396
|
+
</li>
|
397
|
+
|
398
|
+
|
399
|
+
<li class="public ">
|
400
|
+
<span class="summary_signature">
|
401
|
+
|
402
|
+
<a href="#find-instance_method" title="#find (instance method)">#<strong>find</strong>(command, options = {}) {|optional, DBF::Record, NilClass| ... } ⇒ Object </a>
|
403
|
+
|
404
|
+
|
405
|
+
|
406
|
+
</span>
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
|
416
|
+
<span class="summary_desc"><div class='inline'>
|
417
|
+
<p>Find records using a simple ActiveRecord-like syntax.</p>
|
418
|
+
</div></span>
|
419
|
+
|
420
|
+
</li>
|
421
|
+
|
422
|
+
|
423
|
+
<li class="public ">
|
424
|
+
<span class="summary_signature">
|
425
|
+
|
426
|
+
<a href="#has_memo_file%3F-instance_method" title="#has_memo_file? (instance method)">#<strong>has_memo_file?</strong> ⇒ TrueClass, FalseClass </a>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
</span>
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
441
|
+
|
442
|
+
</li>
|
443
|
+
|
444
|
+
|
445
|
+
<li class="public ">
|
446
|
+
<span class="summary_signature">
|
447
|
+
|
448
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(data, memo = nil, encoding = nil) {|_self| ... } ⇒ Table </a>
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
</span>
|
453
|
+
|
454
|
+
|
455
|
+
<span class="note title constructor">constructor</span>
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
<span class="summary_desc"><div class='inline'>
|
465
|
+
<p>Opens a DBF::Table Examples: # working with a file stored on the filesystem table = DBF::Table.new 'data.dbf'.</p>
|
466
|
+
</div></span>
|
467
|
+
|
468
|
+
</li>
|
469
|
+
|
470
|
+
|
471
|
+
<li class="public ">
|
472
|
+
<span class="summary_signature">
|
473
|
+
|
474
|
+
<a href="#record-instance_method" title="#record (instance method)">#<strong>record</strong>(index) ⇒ DBF::Record, NilClass </a>
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
(also: #row)
|
479
|
+
|
480
|
+
</span>
|
481
|
+
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
<span class="summary_desc"><div class='inline'>
|
491
|
+
<p>Retrieve a record by index number.</p>
|
492
|
+
</div></span>
|
493
|
+
|
494
|
+
</li>
|
495
|
+
|
496
|
+
|
497
|
+
<li class="public ">
|
498
|
+
<span class="summary_signature">
|
499
|
+
|
500
|
+
<a href="#to_csv-instance_method" title="#to_csv (instance method)">#<strong>to_csv</strong>(path = nil) ⇒ Object </a>
|
501
|
+
|
502
|
+
|
503
|
+
|
504
|
+
</span>
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
<span class="summary_desc"><div class='inline'>
|
515
|
+
<p>Dumps all records to a CSV file.</p>
|
516
|
+
</div></span>
|
517
|
+
|
518
|
+
</li>
|
519
|
+
|
520
|
+
|
521
|
+
<li class="public ">
|
522
|
+
<span class="summary_signature">
|
523
|
+
|
524
|
+
<a href="#version_description-instance_method" title="#version_description (instance method)">#<strong>version_description</strong> ⇒ String </a>
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
</span>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
536
|
+
|
537
|
+
|
538
|
+
<span class="summary_desc"><div class='inline'>
|
539
|
+
<p>Human readable version description.</p>
|
540
|
+
</div></span>
|
541
|
+
|
542
|
+
</li>
|
543
|
+
|
544
|
+
|
545
|
+
</ul>
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
|
552
|
+
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Schema.html" title="DBF::Schema (module)">Schema</a></span></h3>
|
559
|
+
<p class="inherited"><span class='object_link'><a href="Schema.html#activerecord_schema-instance_method" title="DBF::Schema#activerecord_schema (method)">#activerecord_schema</a></span>, <span class='object_link'><a href="Schema.html#activerecord_schema_definition-instance_method" title="DBF::Schema#activerecord_schema_definition (method)">#activerecord_schema_definition</a></span>, <span class='object_link'><a href="Schema.html#json_schema-instance_method" title="DBF::Schema#json_schema (method)">#json_schema</a></span>, <span class='object_link'><a href="Schema.html#number_data_type-instance_method" title="DBF::Schema#number_data_type (method)">#number_data_type</a></span>, <span class='object_link'><a href="Schema.html#schema-instance_method" title="DBF::Schema#schema (method)">#schema</a></span>, <span class='object_link'><a href="Schema.html#schema_data_type-instance_method" title="DBF::Schema#schema_data_type (method)">#schema_data_type</a></span>, <span class='object_link'><a href="Schema.html#schema_name-instance_method" title="DBF::Schema#schema_name (method)">#schema_name</a></span>, <span class='object_link'><a href="Schema.html#sequel_schema-instance_method" title="DBF::Schema#sequel_schema (method)">#sequel_schema</a></span>, <span class='object_link'><a href="Schema.html#sequel_schema_definition-instance_method" title="DBF::Schema#sequel_schema_definition (method)">#sequel_schema_definition</a></span>, <span class='object_link'><a href="Schema.html#string_data_format-instance_method" title="DBF::Schema#string_data_format (method)">#string_data_format</a></span></p>
|
560
|
+
|
561
|
+
<div id="constructor_details" class="method_details_list">
|
562
|
+
<h2>Constructor Details</h2>
|
563
|
+
|
564
|
+
<div class="method_details first">
|
565
|
+
<h3 class="signature first" id="initialize-instance_method">
|
566
|
+
|
567
|
+
#<strong>initialize</strong>(data, memo = nil, encoding = nil) {|_self| ... } ⇒ <tt><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></tt>
|
568
|
+
|
569
|
+
|
570
|
+
|
571
|
+
|
572
|
+
|
573
|
+
</h3><div class="docstring">
|
574
|
+
<div class="discussion">
|
575
|
+
|
576
|
+
<p>Opens a DBF::Table Examples:</p>
|
577
|
+
|
578
|
+
<pre class="code ruby"><code class="ruby"><span class='comment'># working with a file stored on the filesystem
|
579
|
+
</span><span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data.dbf</span><span class='tstring_end'>'</span></span>
|
580
|
+
|
581
|
+
<span class='comment'># working with a misnamed memo file
|
582
|
+
</span><span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data.dbf</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>memo.dbt</span><span class='tstring_end'>'</span></span>
|
583
|
+
|
584
|
+
<span class='comment'># working with a dbf in memory
|
585
|
+
</span><span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='const'>StringIO</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_dbf_data'>dbf_data</span><span class='rparen'>)</span>
|
586
|
+
|
587
|
+
<span class='comment'># working with a dbf and memo in memory
|
588
|
+
</span><span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='const'>StringIO</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_dbf_data'>dbf_data</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'>StringIO</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_memo_data'>memo_data</span><span class='rparen'>)</span>
|
589
|
+
|
590
|
+
<span class='comment'># working with a dbf overriding specified in the dbf encoding
|
591
|
+
</span><span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data.dbf</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cp437</span><span class='tstring_end'>'</span></span>
|
592
|
+
<span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data.dbf</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>memo.dbt</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='const'>Encoding</span><span class='op'>::</span><span class='const'>US_ASCII</span>
|
593
|
+
</code></pre>
|
594
|
+
|
595
|
+
|
596
|
+
</div>
|
597
|
+
</div>
|
598
|
+
<div class="tags">
|
599
|
+
<p class="tag_title">Parameters:</p>
|
600
|
+
<ul class="param">
|
601
|
+
|
602
|
+
<li>
|
603
|
+
|
604
|
+
<span class='name'>data</span>
|
605
|
+
|
606
|
+
|
607
|
+
<span class='type'>(<tt>String</tt>, <tt>StringIO</tt>)</span>
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
—
|
612
|
+
<div class='inline'>
|
613
|
+
<p>data Path to the dbf file or a StringIO object</p>
|
614
|
+
</div>
|
615
|
+
|
616
|
+
</li>
|
617
|
+
|
618
|
+
<li>
|
619
|
+
|
620
|
+
<span class='name'>memo</span>
|
621
|
+
|
622
|
+
|
623
|
+
<span class='type'>(<tt>optional String</tt>, <tt>StringIO</tt>)</span>
|
624
|
+
|
625
|
+
|
626
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
627
|
+
|
628
|
+
|
629
|
+
—
|
630
|
+
<div class='inline'>
|
631
|
+
<p>memo Path to the memo file or a StringIO object</p>
|
632
|
+
</div>
|
633
|
+
|
634
|
+
</li>
|
635
|
+
|
636
|
+
<li>
|
637
|
+
|
638
|
+
<span class='name'>encoding</span>
|
639
|
+
|
640
|
+
|
641
|
+
<span class='type'>(<tt>optional String</tt>, <tt>Encoding</tt>)</span>
|
642
|
+
|
643
|
+
|
644
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
645
|
+
|
646
|
+
|
647
|
+
—
|
648
|
+
<div class='inline'>
|
649
|
+
<p>encoding Name of the encoding or an Encoding object</p>
|
650
|
+
</div>
|
651
|
+
|
652
|
+
</li>
|
653
|
+
|
654
|
+
</ul>
|
655
|
+
|
656
|
+
<p class="tag_title">Yields:</p>
|
657
|
+
<ul class="yield">
|
658
|
+
|
659
|
+
<li>
|
660
|
+
|
661
|
+
|
662
|
+
<span class='type'>(<tt>_self</tt>)</span>
|
663
|
+
|
664
|
+
|
665
|
+
|
666
|
+
</li>
|
667
|
+
|
668
|
+
</ul>
|
669
|
+
<p class="tag_title">Yield Parameters:</p>
|
670
|
+
<ul class="yieldparam">
|
671
|
+
|
672
|
+
<li>
|
673
|
+
|
674
|
+
<span class='name'>_self</span>
|
675
|
+
|
676
|
+
|
677
|
+
<span class='type'>(<tt><span class='object_link'><a href="" title="DBF::Table (class)">DBF::Table</a></span></tt>)</span>
|
678
|
+
|
679
|
+
|
680
|
+
|
681
|
+
—
|
682
|
+
<div class='inline'>
|
683
|
+
<p>the object that the method was called on</p>
|
684
|
+
</div>
|
685
|
+
|
686
|
+
</li>
|
687
|
+
|
688
|
+
</ul>
|
689
|
+
|
690
|
+
</div><table class="source_code">
|
691
|
+
<tr>
|
692
|
+
<td>
|
693
|
+
<pre class="lines">
|
694
|
+
|
695
|
+
|
696
|
+
74
|
697
|
+
75
|
698
|
+
76
|
699
|
+
77
|
700
|
+
78
|
701
|
+
79</pre>
|
702
|
+
</td>
|
703
|
+
<td>
|
704
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 74</span>
|
705
|
+
|
706
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_memo'>memo</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_encoding'>encoding</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
707
|
+
<span class='ivar'>@data</span> <span class='op'>=</span> <span class='id identifier rubyid_open_data'>open_data</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
708
|
+
<span class='ivar'>@encoding</span> <span class='op'>=</span> <span class='id identifier rubyid_encoding'>encoding</span> <span class='op'>||</span> <span class='id identifier rubyid_header'>header</span><span class='period'>.</span><span class='id identifier rubyid_encoding'>encoding</span>
|
709
|
+
<span class='ivar'>@memo</span> <span class='op'>=</span> <span class='id identifier rubyid_open_memo'>open_memo</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_memo'>memo</span><span class='rparen'>)</span>
|
710
|
+
<span class='kw'>yield</span> <span class='kw'>self</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
711
|
+
<span class='kw'>end</span></pre>
|
712
|
+
</td>
|
713
|
+
</tr>
|
714
|
+
</table>
|
715
|
+
</div>
|
716
|
+
|
717
|
+
</div>
|
718
|
+
|
719
|
+
<div id="instance_attr_details" class="attr_details">
|
720
|
+
<h2>Instance Attribute Details</h2>
|
721
|
+
|
722
|
+
|
723
|
+
<span id="encoding=-instance_method"></span>
|
724
|
+
<div class="method_details first">
|
725
|
+
<h3 class="signature first" id="encoding-instance_method">
|
726
|
+
|
727
|
+
#<strong>encoding</strong> ⇒ <tt>Object</tt>
|
728
|
+
|
729
|
+
|
730
|
+
|
731
|
+
|
732
|
+
|
733
|
+
</h3><div class="docstring">
|
734
|
+
<div class="discussion">
|
735
|
+
|
736
|
+
<p>Returns the value of attribute encoding.</p>
|
737
|
+
|
738
|
+
|
739
|
+
</div>
|
740
|
+
</div>
|
741
|
+
<div class="tags">
|
742
|
+
|
743
|
+
|
744
|
+
</div><table class="source_code">
|
745
|
+
<tr>
|
746
|
+
<td>
|
747
|
+
<pre class="lines">
|
748
|
+
|
749
|
+
|
750
|
+
45
|
751
|
+
46
|
752
|
+
47</pre>
|
753
|
+
</td>
|
754
|
+
<td>
|
755
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 45</span>
|
756
|
+
|
757
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_encoding'>encoding</span>
|
758
|
+
<span class='ivar'>@encoding</span>
|
759
|
+
<span class='kw'>end</span></pre>
|
760
|
+
</td>
|
761
|
+
</tr>
|
762
|
+
</table>
|
763
|
+
</div>
|
764
|
+
|
765
|
+
|
766
|
+
<span id="name=-instance_method"></span>
|
767
|
+
<div class="method_details ">
|
768
|
+
<h3 class="signature " id="name-instance_method">
|
769
|
+
|
770
|
+
#<strong>name</strong> ⇒ <tt>String</tt>
|
771
|
+
|
772
|
+
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
</h3><div class="docstring">
|
777
|
+
<div class="discussion">
|
778
|
+
|
779
|
+
|
780
|
+
</div>
|
781
|
+
</div>
|
782
|
+
<div class="tags">
|
783
|
+
|
784
|
+
<p class="tag_title">Returns:</p>
|
785
|
+
<ul class="return">
|
786
|
+
|
787
|
+
<li>
|
788
|
+
|
789
|
+
|
790
|
+
<span class='type'>(<tt>String</tt>)</span>
|
791
|
+
|
792
|
+
|
793
|
+
|
794
|
+
</li>
|
795
|
+
|
796
|
+
</ul>
|
797
|
+
|
798
|
+
</div><table class="source_code">
|
799
|
+
<tr>
|
800
|
+
<td>
|
801
|
+
<pre class="lines">
|
802
|
+
|
803
|
+
|
804
|
+
171
|
805
|
+
172
|
806
|
+
173</pre>
|
807
|
+
</td>
|
808
|
+
<td>
|
809
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 171</span>
|
810
|
+
|
811
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
812
|
+
<span class='ivar'>@name</span> <span class='op'>||=</span> <span class='id identifier rubyid_filename'>filename</span> <span class='op'>&&</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.*</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
813
|
+
<span class='kw'>end</span></pre>
|
814
|
+
</td>
|
815
|
+
</tr>
|
816
|
+
</table>
|
817
|
+
</div>
|
818
|
+
|
819
|
+
</div>
|
820
|
+
|
821
|
+
|
822
|
+
<div id="instance_method_details" class="method_details_list">
|
823
|
+
<h2>Instance Method Details</h2>
|
824
|
+
|
825
|
+
|
826
|
+
<div class="method_details first">
|
827
|
+
<h3 class="signature first" id="close-instance_method">
|
828
|
+
|
829
|
+
#<strong>close</strong> ⇒ <tt>TrueClass</tt>, <tt>FalseClass</tt>
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
|
834
|
+
|
835
|
+
</h3><div class="docstring">
|
836
|
+
<div class="discussion">
|
837
|
+
|
838
|
+
<p>Closes the table and memo file</p>
|
839
|
+
|
840
|
+
|
841
|
+
</div>
|
842
|
+
</div>
|
843
|
+
<div class="tags">
|
844
|
+
|
845
|
+
<p class="tag_title">Returns:</p>
|
846
|
+
<ul class="return">
|
847
|
+
|
848
|
+
<li>
|
849
|
+
|
850
|
+
|
851
|
+
<span class='type'>(<tt>TrueClass</tt>, <tt>FalseClass</tt>)</span>
|
852
|
+
|
853
|
+
|
854
|
+
|
855
|
+
</li>
|
856
|
+
|
857
|
+
</ul>
|
858
|
+
|
859
|
+
</div><table class="source_code">
|
860
|
+
<tr>
|
861
|
+
<td>
|
862
|
+
<pre class="lines">
|
863
|
+
|
864
|
+
|
865
|
+
84
|
866
|
+
85
|
867
|
+
86
|
868
|
+
87</pre>
|
869
|
+
</td>
|
870
|
+
<td>
|
871
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 84</span>
|
872
|
+
|
873
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_close'>close</span>
|
874
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
875
|
+
<span class='ivar'>@memo</span> <span class='op'>&&</span> <span class='ivar'>@memo</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
876
|
+
<span class='kw'>end</span></pre>
|
877
|
+
</td>
|
878
|
+
</tr>
|
879
|
+
</table>
|
880
|
+
</div>
|
881
|
+
|
882
|
+
<div class="method_details ">
|
883
|
+
<h3 class="signature " id="closed?-instance_method">
|
884
|
+
|
885
|
+
#<strong>closed?</strong> ⇒ <tt>TrueClass</tt>, <tt>FalseClass</tt>
|
886
|
+
|
887
|
+
|
888
|
+
|
889
|
+
|
890
|
+
|
891
|
+
</h3><div class="docstring">
|
892
|
+
<div class="discussion">
|
893
|
+
|
894
|
+
|
895
|
+
</div>
|
896
|
+
</div>
|
897
|
+
<div class="tags">
|
898
|
+
|
899
|
+
<p class="tag_title">Returns:</p>
|
900
|
+
<ul class="return">
|
901
|
+
|
902
|
+
<li>
|
903
|
+
|
904
|
+
|
905
|
+
<span class='type'>(<tt>TrueClass</tt>, <tt>FalseClass</tt>)</span>
|
906
|
+
|
907
|
+
|
908
|
+
|
909
|
+
</li>
|
910
|
+
|
911
|
+
</ul>
|
912
|
+
|
913
|
+
</div><table class="source_code">
|
914
|
+
<tr>
|
915
|
+
<td>
|
916
|
+
<pre class="lines">
|
917
|
+
|
918
|
+
|
919
|
+
90
|
920
|
+
91
|
921
|
+
92
|
922
|
+
93
|
923
|
+
94
|
924
|
+
95
|
925
|
+
96</pre>
|
926
|
+
</td>
|
927
|
+
<td>
|
928
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 90</span>
|
929
|
+
|
930
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_closed?'>closed?</span>
|
931
|
+
<span class='kw'>if</span> <span class='ivar'>@memo</span>
|
932
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span> <span class='op'>&&</span> <span class='ivar'>@memo</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
|
933
|
+
<span class='kw'>else</span>
|
934
|
+
<span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_closed?'>closed?</span>
|
935
|
+
<span class='kw'>end</span>
|
936
|
+
<span class='kw'>end</span></pre>
|
937
|
+
</td>
|
938
|
+
</tr>
|
939
|
+
</table>
|
940
|
+
</div>
|
941
|
+
|
942
|
+
<div class="method_details ">
|
943
|
+
<h3 class="signature " id="column_names-instance_method">
|
944
|
+
|
945
|
+
#<strong>column_names</strong> ⇒ <tt>String</tt>
|
946
|
+
|
947
|
+
|
948
|
+
|
949
|
+
|
950
|
+
|
951
|
+
</h3><div class="docstring">
|
952
|
+
<div class="discussion">
|
953
|
+
|
954
|
+
<p>Column names</p>
|
955
|
+
|
956
|
+
|
957
|
+
</div>
|
958
|
+
</div>
|
959
|
+
<div class="tags">
|
960
|
+
|
961
|
+
<p class="tag_title">Returns:</p>
|
962
|
+
<ul class="return">
|
963
|
+
|
964
|
+
<li>
|
965
|
+
|
966
|
+
|
967
|
+
<span class='type'>(<tt>String</tt>)</span>
|
968
|
+
|
969
|
+
|
970
|
+
|
971
|
+
</li>
|
972
|
+
|
973
|
+
</ul>
|
974
|
+
|
975
|
+
</div><table class="source_code">
|
976
|
+
<tr>
|
977
|
+
<td>
|
978
|
+
<pre class="lines">
|
979
|
+
|
980
|
+
|
981
|
+
101
|
982
|
+
102
|
983
|
+
103</pre>
|
984
|
+
</td>
|
985
|
+
<td>
|
986
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 101</span>
|
987
|
+
|
988
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_column_names'>column_names</span>
|
989
|
+
<span class='ivar'>@column_names</span> <span class='op'>||=</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'>&</span><span class='symbol'>:name</span><span class='rparen'>)</span>
|
990
|
+
<span class='kw'>end</span></pre>
|
991
|
+
</td>
|
992
|
+
</tr>
|
993
|
+
</table>
|
994
|
+
</div>
|
995
|
+
|
996
|
+
<div class="method_details ">
|
997
|
+
<h3 class="signature " id="columns-instance_method">
|
998
|
+
|
999
|
+
#<strong>columns</strong> ⇒ <tt>Array</tt>
|
1000
|
+
|
1001
|
+
|
1002
|
+
|
1003
|
+
|
1004
|
+
|
1005
|
+
</h3><div class="docstring">
|
1006
|
+
<div class="discussion">
|
1007
|
+
|
1008
|
+
<p>All columns</p>
|
1009
|
+
|
1010
|
+
|
1011
|
+
</div>
|
1012
|
+
</div>
|
1013
|
+
<div class="tags">
|
1014
|
+
|
1015
|
+
<p class="tag_title">Returns:</p>
|
1016
|
+
<ul class="return">
|
1017
|
+
|
1018
|
+
<li>
|
1019
|
+
|
1020
|
+
|
1021
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
1022
|
+
|
1023
|
+
|
1024
|
+
|
1025
|
+
</li>
|
1026
|
+
|
1027
|
+
</ul>
|
1028
|
+
|
1029
|
+
</div><table class="source_code">
|
1030
|
+
<tr>
|
1031
|
+
<td>
|
1032
|
+
<pre class="lines">
|
1033
|
+
|
1034
|
+
|
1035
|
+
108
|
1036
|
+
109
|
1037
|
+
110</pre>
|
1038
|
+
</td>
|
1039
|
+
<td>
|
1040
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 108</span>
|
1041
|
+
|
1042
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_columns'>columns</span>
|
1043
|
+
<span class='ivar'>@columns</span> <span class='op'>||=</span> <span class='id identifier rubyid_build_columns'>build_columns</span>
|
1044
|
+
<span class='kw'>end</span></pre>
|
1045
|
+
</td>
|
1046
|
+
</tr>
|
1047
|
+
</table>
|
1048
|
+
</div>
|
1049
|
+
|
1050
|
+
<div class="method_details ">
|
1051
|
+
<h3 class="signature " id="each-instance_method">
|
1052
|
+
|
1053
|
+
#<strong>each</strong> {|nil, DBF::Record| ... } ⇒ <tt>Object</tt>
|
1054
|
+
|
1055
|
+
|
1056
|
+
|
1057
|
+
|
1058
|
+
|
1059
|
+
</h3><div class="docstring">
|
1060
|
+
<div class="discussion">
|
1061
|
+
|
1062
|
+
<p>Calls block once for each record in the table. The record may be nil if the record has been marked as deleted.</p>
|
1063
|
+
|
1064
|
+
|
1065
|
+
</div>
|
1066
|
+
</div>
|
1067
|
+
<div class="tags">
|
1068
|
+
|
1069
|
+
<p class="tag_title">Yields:</p>
|
1070
|
+
<ul class="yield">
|
1071
|
+
|
1072
|
+
<li>
|
1073
|
+
|
1074
|
+
|
1075
|
+
<span class='type'>(<tt>nil</tt>, <tt><span class='object_link'><a href="Record.html" title="DBF::Record (class)">DBF::Record</a></span></tt>)</span>
|
1076
|
+
|
1077
|
+
|
1078
|
+
|
1079
|
+
</li>
|
1080
|
+
|
1081
|
+
</ul>
|
1082
|
+
|
1083
|
+
</div><table class="source_code">
|
1084
|
+
<tr>
|
1085
|
+
<td>
|
1086
|
+
<pre class="lines">
|
1087
|
+
|
1088
|
+
|
1089
|
+
116
|
1090
|
+
117
|
1091
|
+
118</pre>
|
1092
|
+
</td>
|
1093
|
+
<td>
|
1094
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 116</span>
|
1095
|
+
|
1096
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span>
|
1097
|
+
<span class='id identifier rubyid_record_count'>record_count</span><span class='period'>.</span><span class='id identifier rubyid_times'>times</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='kw'>yield</span> <span class='id identifier rubyid_record'>record</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1098
|
+
<span class='kw'>end</span></pre>
|
1099
|
+
</td>
|
1100
|
+
</tr>
|
1101
|
+
</table>
|
1102
|
+
</div>
|
1103
|
+
|
1104
|
+
<div class="method_details ">
|
1105
|
+
<h3 class="signature " id="filename-instance_method">
|
1106
|
+
|
1107
|
+
#<strong>filename</strong> ⇒ <tt>String</tt>
|
1108
|
+
|
1109
|
+
|
1110
|
+
|
1111
|
+
|
1112
|
+
|
1113
|
+
</h3><div class="docstring">
|
1114
|
+
<div class="discussion">
|
1115
|
+
|
1116
|
+
|
1117
|
+
</div>
|
1118
|
+
</div>
|
1119
|
+
<div class="tags">
|
1120
|
+
|
1121
|
+
<p class="tag_title">Returns:</p>
|
1122
|
+
<ul class="return">
|
1123
|
+
|
1124
|
+
<li>
|
1125
|
+
|
1126
|
+
|
1127
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1128
|
+
|
1129
|
+
|
1130
|
+
|
1131
|
+
</li>
|
1132
|
+
|
1133
|
+
</ul>
|
1134
|
+
|
1135
|
+
</div><table class="source_code">
|
1136
|
+
<tr>
|
1137
|
+
<td>
|
1138
|
+
<pre class="lines">
|
1139
|
+
|
1140
|
+
|
1141
|
+
121
|
1142
|
+
122
|
1143
|
+
123
|
1144
|
+
124
|
1145
|
+
125</pre>
|
1146
|
+
</td>
|
1147
|
+
<td>
|
1148
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 121</span>
|
1149
|
+
|
1150
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_filename'>filename</span>
|
1151
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:path</span><span class='rparen'>)</span>
|
1152
|
+
|
1153
|
+
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_basename'>basename</span><span class='lparen'>(</span><span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
1154
|
+
<span class='kw'>end</span></pre>
|
1155
|
+
</td>
|
1156
|
+
</tr>
|
1157
|
+
</table>
|
1158
|
+
</div>
|
1159
|
+
|
1160
|
+
<div class="method_details ">
|
1161
|
+
<h3 class="signature " id="find-instance_method">
|
1162
|
+
|
1163
|
+
#<strong>find</strong>(command, options = {}) {|optional, DBF::Record, NilClass| ... } ⇒ <tt>Object</tt>
|
1164
|
+
|
1165
|
+
|
1166
|
+
|
1167
|
+
|
1168
|
+
|
1169
|
+
</h3><div class="docstring">
|
1170
|
+
<div class="discussion">
|
1171
|
+
|
1172
|
+
<p>Find records using a simple ActiveRecord-like syntax.</p>
|
1173
|
+
|
1174
|
+
<p>Examples:</p>
|
1175
|
+
|
1176
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_table'>table</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="" title="DBF::Table (class)">Table</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="#initialize-instance_method" title="DBF::Table#initialize (method)">new</a></span></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mydata.dbf</span><span class='tstring_end'>'</span></span>
|
1177
|
+
|
1178
|
+
<span class='comment'># Find record number 5
|
1179
|
+
</span><span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='int'>5</span><span class='rparen'>)</span>
|
1180
|
+
|
1181
|
+
<span class='comment'># Find all records for Keith Morrison
|
1182
|
+
</span><span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='symbol'>:all</span><span class='comma'>,</span> <span class='label'>first_name:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Keith</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='label'>last_name:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Morrison</span><span class='tstring_end'>"</span></span>
|
1183
|
+
|
1184
|
+
<span class='comment'># Find first record
|
1185
|
+
</span><span class='id identifier rubyid_table'>table</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='symbol'>:first</span><span class='comma'>,</span> <span class='label'>first_name:</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Keith</span><span class='tstring_end'>"</span></span>
|
1186
|
+
</code></pre>
|
1187
|
+
|
1188
|
+
<p>The <strong>command</strong> may be a record index, :all, or :first. <strong>options</strong> is optional and, if specified, should be a hash where the keys correspond to column names in the database. The values will be matched exactly with the value in the database. If you specify more than one key, all values must match in order for the record to be returned. The equivalent SQL would be “WHERE key1 = 'value1' AND key2 = 'value2'”.</p>
|
1189
|
+
|
1190
|
+
|
1191
|
+
</div>
|
1192
|
+
</div>
|
1193
|
+
<div class="tags">
|
1194
|
+
<p class="tag_title">Parameters:</p>
|
1195
|
+
<ul class="param">
|
1196
|
+
|
1197
|
+
<li>
|
1198
|
+
|
1199
|
+
<span class='name'>command</span>
|
1200
|
+
|
1201
|
+
|
1202
|
+
<span class='type'>(<tt>Integer</tt>, <tt>Symbol</tt>)</span>
|
1203
|
+
|
1204
|
+
|
1205
|
+
|
1206
|
+
—
|
1207
|
+
<div class='inline'>
|
1208
|
+
<p>command</p>
|
1209
|
+
</div>
|
1210
|
+
|
1211
|
+
</li>
|
1212
|
+
|
1213
|
+
<li>
|
1214
|
+
|
1215
|
+
<span class='name'>options</span>
|
1216
|
+
|
1217
|
+
|
1218
|
+
<span class='type'>(<tt>optional</tt>, <tt>Hash</tt>)</span>
|
1219
|
+
|
1220
|
+
|
1221
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
1222
|
+
|
1223
|
+
|
1224
|
+
—
|
1225
|
+
<div class='inline'>
|
1226
|
+
<p>options Hash of search parameters</p>
|
1227
|
+
</div>
|
1228
|
+
|
1229
|
+
</li>
|
1230
|
+
|
1231
|
+
</ul>
|
1232
|
+
|
1233
|
+
<p class="tag_title">Yields:</p>
|
1234
|
+
<ul class="yield">
|
1235
|
+
|
1236
|
+
<li>
|
1237
|
+
|
1238
|
+
|
1239
|
+
<span class='type'>(<tt>optional</tt>, <tt><span class='object_link'><a href="Record.html" title="DBF::Record (class)">DBF::Record</a></span></tt>, <tt>NilClass</tt>)</span>
|
1240
|
+
|
1241
|
+
|
1242
|
+
|
1243
|
+
</li>
|
1244
|
+
|
1245
|
+
</ul>
|
1246
|
+
|
1247
|
+
</div><table class="source_code">
|
1248
|
+
<tr>
|
1249
|
+
<td>
|
1250
|
+
<pre class="lines">
|
1251
|
+
|
1252
|
+
|
1253
|
+
152
|
1254
|
+
153
|
1255
|
+
154
|
1256
|
+
155
|
1257
|
+
156
|
1258
|
+
157
|
1259
|
+
158
|
1260
|
+
159
|
1261
|
+
160
|
1262
|
+
161
|
1263
|
+
162
|
1264
|
+
163</pre>
|
1265
|
+
</td>
|
1266
|
+
<td>
|
1267
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 152</span>
|
1268
|
+
|
1269
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find'>find</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1270
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_command'>command</span>
|
1271
|
+
<span class='kw'>when</span> <span class='const'>Integer</span>
|
1272
|
+
<span class='id identifier rubyid_record'>record</span><span class='lparen'>(</span><span class='id identifier rubyid_command'>command</span><span class='rparen'>)</span>
|
1273
|
+
<span class='kw'>when</span> <span class='const'>Array</span>
|
1274
|
+
<span class='id identifier rubyid_command'>command</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_record'>record</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1275
|
+
<span class='kw'>when</span> <span class='symbol'>:all</span>
|
1276
|
+
<span class='id identifier rubyid_find_all'>find_all</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1277
|
+
<span class='kw'>when</span> <span class='symbol'>:first</span>
|
1278
|
+
<span class='id identifier rubyid_find_first'>find_first</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
|
1279
|
+
<span class='kw'>end</span>
|
1280
|
+
<span class='kw'>end</span></pre>
|
1281
|
+
</td>
|
1282
|
+
</tr>
|
1283
|
+
</table>
|
1284
|
+
</div>
|
1285
|
+
|
1286
|
+
<div class="method_details ">
|
1287
|
+
<h3 class="signature " id="has_memo_file?-instance_method">
|
1288
|
+
|
1289
|
+
#<strong>has_memo_file?</strong> ⇒ <tt>TrueClass</tt>, <tt>FalseClass</tt>
|
1290
|
+
|
1291
|
+
|
1292
|
+
|
1293
|
+
|
1294
|
+
|
1295
|
+
</h3><div class="docstring">
|
1296
|
+
<div class="discussion">
|
1297
|
+
|
1298
|
+
|
1299
|
+
</div>
|
1300
|
+
</div>
|
1301
|
+
<div class="tags">
|
1302
|
+
|
1303
|
+
<p class="tag_title">Returns:</p>
|
1304
|
+
<ul class="return">
|
1305
|
+
|
1306
|
+
<li>
|
1307
|
+
|
1308
|
+
|
1309
|
+
<span class='type'>(<tt>TrueClass</tt>, <tt>FalseClass</tt>)</span>
|
1310
|
+
|
1311
|
+
|
1312
|
+
|
1313
|
+
</li>
|
1314
|
+
|
1315
|
+
</ul>
|
1316
|
+
|
1317
|
+
</div><table class="source_code">
|
1318
|
+
<tr>
|
1319
|
+
<td>
|
1320
|
+
<pre class="lines">
|
1321
|
+
|
1322
|
+
|
1323
|
+
166
|
1324
|
+
167
|
1325
|
+
168</pre>
|
1326
|
+
</td>
|
1327
|
+
<td>
|
1328
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 166</span>
|
1329
|
+
|
1330
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_has_memo_file?'>has_memo_file?</span>
|
1331
|
+
<span class='op'>!</span><span class='op'>!</span><span class='ivar'>@memo</span>
|
1332
|
+
<span class='kw'>end</span></pre>
|
1333
|
+
</td>
|
1334
|
+
</tr>
|
1335
|
+
</table>
|
1336
|
+
</div>
|
1337
|
+
|
1338
|
+
<div class="method_details ">
|
1339
|
+
<h3 class="signature " id="record-instance_method">
|
1340
|
+
|
1341
|
+
#<strong>record</strong>(index) ⇒ <tt><span class='object_link'><a href="Record.html" title="DBF::Record (class)">DBF::Record</a></span></tt>, <tt>NilClass</tt>
|
1342
|
+
|
1343
|
+
|
1344
|
+
|
1345
|
+
<span class="aliases">Also known as:
|
1346
|
+
<span class="names"><span id='row-instance_method'>row</span></span>
|
1347
|
+
</span>
|
1348
|
+
|
1349
|
+
|
1350
|
+
|
1351
|
+
</h3><div class="docstring">
|
1352
|
+
<div class="discussion">
|
1353
|
+
|
1354
|
+
<p>Retrieve a record by index number. The record will be nil if it has been deleted, but not yet pruned from the database.</p>
|
1355
|
+
|
1356
|
+
|
1357
|
+
</div>
|
1358
|
+
</div>
|
1359
|
+
<div class="tags">
|
1360
|
+
<p class="tag_title">Parameters:</p>
|
1361
|
+
<ul class="param">
|
1362
|
+
|
1363
|
+
<li>
|
1364
|
+
|
1365
|
+
<span class='name'>index</span>
|
1366
|
+
|
1367
|
+
|
1368
|
+
<span class='type'>(<tt>Integer</tt>)</span>
|
1369
|
+
|
1370
|
+
|
1371
|
+
|
1372
|
+
</li>
|
1373
|
+
|
1374
|
+
</ul>
|
1375
|
+
|
1376
|
+
<p class="tag_title">Returns:</p>
|
1377
|
+
<ul class="return">
|
1378
|
+
|
1379
|
+
<li>
|
1380
|
+
|
1381
|
+
|
1382
|
+
<span class='type'>(<tt><span class='object_link'><a href="Record.html" title="DBF::Record (class)">DBF::Record</a></span></tt>, <tt>NilClass</tt>)</span>
|
1383
|
+
|
1384
|
+
|
1385
|
+
|
1386
|
+
</li>
|
1387
|
+
|
1388
|
+
</ul>
|
1389
|
+
<p class="tag_title">Raises:</p>
|
1390
|
+
<ul class="raise">
|
1391
|
+
|
1392
|
+
<li>
|
1393
|
+
|
1394
|
+
|
1395
|
+
<span class='type'>(<tt><span class='object_link'><a href="NoColumnsDefined.html" title="DBF::NoColumnsDefined (class)">DBF::NoColumnsDefined</a></span></tt>)</span>
|
1396
|
+
|
1397
|
+
|
1398
|
+
|
1399
|
+
</li>
|
1400
|
+
|
1401
|
+
</ul>
|
1402
|
+
|
1403
|
+
</div><table class="source_code">
|
1404
|
+
<tr>
|
1405
|
+
<td>
|
1406
|
+
<pre class="lines">
|
1407
|
+
|
1408
|
+
|
1409
|
+
181
|
1410
|
+
182
|
1411
|
+
183
|
1412
|
+
184
|
1413
|
+
185
|
1414
|
+
186
|
1415
|
+
187
|
1416
|
+
188
|
1417
|
+
189</pre>
|
1418
|
+
</td>
|
1419
|
+
<td>
|
1420
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 181</span>
|
1421
|
+
|
1422
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_record'>record</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
1423
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="NoColumnsDefined.html" title="DBF::NoColumnsDefined (class)">NoColumnsDefined</a></span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>The DBF file has no columns defined</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_columns'>columns</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1424
|
+
|
1425
|
+
<span class='id identifier rubyid_seek_to_record'>seek_to_record</span><span class='lparen'>(</span><span class='id identifier rubyid_index'>index</span><span class='rparen'>)</span>
|
1426
|
+
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_deleted_record?'>deleted_record?</span>
|
1427
|
+
|
1428
|
+
<span class='id identifier rubyid_record_data'>record_data</span> <span class='op'>=</span> <span class='ivar'>@data</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='id identifier rubyid_record_length'>record_length</span><span class='rparen'>)</span>
|
1429
|
+
<span class='const'><span class='object_link'><a href="../DBF.html" title="DBF (module)">DBF</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Record.html" title="DBF::Record (class)">Record</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Record.html#initialize-instance_method" title="DBF::Record#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_record_data'>record_data</span><span class='comma'>,</span> <span class='id identifier rubyid_columns'>columns</span><span class='comma'>,</span> <span class='id identifier rubyid_version'>version</span><span class='comma'>,</span> <span class='ivar'>@memo</span><span class='rparen'>)</span>
|
1430
|
+
<span class='kw'>end</span></pre>
|
1431
|
+
</td>
|
1432
|
+
</tr>
|
1433
|
+
</table>
|
1434
|
+
</div>
|
1435
|
+
|
1436
|
+
<div class="method_details ">
|
1437
|
+
<h3 class="signature " id="to_csv-instance_method">
|
1438
|
+
|
1439
|
+
#<strong>to_csv</strong>(path = nil) ⇒ <tt>Object</tt>
|
1440
|
+
|
1441
|
+
|
1442
|
+
|
1443
|
+
|
1444
|
+
|
1445
|
+
</h3><div class="docstring">
|
1446
|
+
<div class="discussion">
|
1447
|
+
|
1448
|
+
<p>Dumps all records to a CSV file. If no filename is given then CSV is output to STDOUT.</p>
|
1449
|
+
|
1450
|
+
|
1451
|
+
</div>
|
1452
|
+
</div>
|
1453
|
+
<div class="tags">
|
1454
|
+
<p class="tag_title">Parameters:</p>
|
1455
|
+
<ul class="param">
|
1456
|
+
|
1457
|
+
<li>
|
1458
|
+
|
1459
|
+
<span class='name'>path</span>
|
1460
|
+
|
1461
|
+
|
1462
|
+
<span class='type'>(<tt>optional String</tt>)</span>
|
1463
|
+
|
1464
|
+
|
1465
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
1466
|
+
|
1467
|
+
|
1468
|
+
—
|
1469
|
+
<div class='inline'>
|
1470
|
+
<p>Defaults to STDOUT</p>
|
1471
|
+
</div>
|
1472
|
+
|
1473
|
+
</li>
|
1474
|
+
|
1475
|
+
</ul>
|
1476
|
+
|
1477
|
+
|
1478
|
+
</div><table class="source_code">
|
1479
|
+
<tr>
|
1480
|
+
<td>
|
1481
|
+
<pre class="lines">
|
1482
|
+
|
1483
|
+
|
1484
|
+
197
|
1485
|
+
198
|
1486
|
+
199
|
1487
|
+
200
|
1488
|
+
201
|
1489
|
+
202</pre>
|
1490
|
+
</td>
|
1491
|
+
<td>
|
1492
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 197</span>
|
1493
|
+
|
1494
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_csv'>to_csv</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1495
|
+
<span class='id identifier rubyid_out_io'>out_io</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>?</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>:</span> <span class='gvar'>$stdout</span>
|
1496
|
+
<span class='id identifier rubyid_csv'>csv</span> <span class='op'>=</span> <span class='const'>CSV</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_out_io'>out_io</span><span class='comma'>,</span> <span class='label'>force_quotes:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1497
|
+
<span class='id identifier rubyid_csv'>csv</span> <span class='op'><<</span> <span class='id identifier rubyid_column_names'>column_names</span>
|
1498
|
+
<span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_record'>record</span><span class='op'>|</span> <span class='id identifier rubyid_csv'>csv</span> <span class='op'><<</span> <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span> <span class='rbrace'>}</span>
|
1499
|
+
<span class='kw'>end</span></pre>
|
1500
|
+
</td>
|
1501
|
+
</tr>
|
1502
|
+
</table>
|
1503
|
+
</div>
|
1504
|
+
|
1505
|
+
<div class="method_details ">
|
1506
|
+
<h3 class="signature " id="version_description-instance_method">
|
1507
|
+
|
1508
|
+
#<strong>version_description</strong> ⇒ <tt>String</tt>
|
1509
|
+
|
1510
|
+
|
1511
|
+
|
1512
|
+
|
1513
|
+
|
1514
|
+
</h3><div class="docstring">
|
1515
|
+
<div class="discussion">
|
1516
|
+
|
1517
|
+
<p>Human readable version description</p>
|
1518
|
+
|
1519
|
+
|
1520
|
+
</div>
|
1521
|
+
</div>
|
1522
|
+
<div class="tags">
|
1523
|
+
|
1524
|
+
<p class="tag_title">Returns:</p>
|
1525
|
+
<ul class="return">
|
1526
|
+
|
1527
|
+
<li>
|
1528
|
+
|
1529
|
+
|
1530
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1531
|
+
|
1532
|
+
|
1533
|
+
|
1534
|
+
</li>
|
1535
|
+
|
1536
|
+
</ul>
|
1537
|
+
|
1538
|
+
</div><table class="source_code">
|
1539
|
+
<tr>
|
1540
|
+
<td>
|
1541
|
+
<pre class="lines">
|
1542
|
+
|
1543
|
+
|
1544
|
+
207
|
1545
|
+
208
|
1546
|
+
209</pre>
|
1547
|
+
</td>
|
1548
|
+
<td>
|
1549
|
+
<pre class="code"><span class="info file"># File 'lib/dbf/table.rb', line 207</span>
|
1550
|
+
|
1551
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_version_description'>version_description</span>
|
1552
|
+
<span class='const'><span class='object_link'><a href="#VERSIONS-constant" title="DBF::Table::VERSIONS (constant)">VERSIONS</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_version'>version</span><span class='rbracket'>]</span>
|
1553
|
+
<span class='kw'>end</span></pre>
|
1554
|
+
</td>
|
1555
|
+
</tr>
|
1556
|
+
</table>
|
1557
|
+
</div>
|
1558
|
+
|
1559
|
+
</div>
|
1560
|
+
|
1561
|
+
</div>
|
1562
|
+
|
1563
|
+
<div id="footer">
|
1564
|
+
Generated on Sun Aug 8 16:19:08 2021 by
|
1565
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1566
|
+
0.9.26 (ruby-3.0.1).
|
1567
|
+
</div>
|
1568
|
+
|
1569
|
+
</div>
|
1570
|
+
</body>
|
1571
|
+
</html>
|