csv2hash 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -5
- data/.yardoc/checksums +25 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +15 -1
- data/README.md +32 -4
- data/UPGRADE.md +2 -0
- data/bin/generate_doc +3 -0
- data/config/example.csv +10 -0
- data/config/rules.yml +7 -0
- data/doc/Cell.html +282 -0
- data/doc/Csv2hash/Adapter/Abstract.html +215 -0
- data/doc/Csv2hash/Adapter/Base/UnsupportedAdapter.html +123 -0
- data/doc/Csv2hash/Adapter/Base.html +201 -0
- data/doc/Csv2hash/Adapter/CsvAdapter.html +348 -0
- data/doc/Csv2hash/Adapter/MemoryAdapter.html +348 -0
- data/doc/Csv2hash/Adapter.html +117 -0
- data/doc/Csv2hash/DataWrapper.html +500 -0
- data/doc/Csv2hash/Definition.html +1008 -0
- data/doc/Csv2hash/Discover.html +192 -0
- data/doc/Csv2hash/Expectation.html +202 -0
- data/doc/Csv2hash/ExtraValidator.html +207 -0
- data/doc/Csv2hash/Main.html +1298 -0
- data/doc/Csv2hash/Notifier.html +189 -0
- data/doc/Csv2hash/Parser/Collection.html +283 -0
- data/doc/Csv2hash/Parser/Mapping.html +266 -0
- data/doc/Csv2hash/Parser.html +121 -0
- data/doc/Csv2hash/StructureValidator/Deprecation.html +215 -0
- data/doc/Csv2hash/StructureValidator/MaxColumns.html +327 -0
- data/doc/Csv2hash/StructureValidator/MinColumns.html +327 -0
- data/doc/Csv2hash/StructureValidator/ValidationError.html +123 -0
- data/doc/Csv2hash/StructureValidator/Validator.html +184 -0
- data/doc/Csv2hash/StructureValidator.html +311 -0
- data/doc/Csv2hash/Validator/Collection.html +217 -0
- data/doc/Csv2hash/Validator/Mapping.html +200 -0
- data/doc/Csv2hash/Validator.html +295 -0
- data/doc/Csv2hash.html +131 -0
- data/doc/CsvArray.html +200 -0
- data/doc/Registry.html +312 -0
- data/doc/_index.html +391 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +499 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +499 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +473 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/csv2hash/definition.rb +3 -3
- data/lib/csv2hash/version.rb +1 -1
- data/lib/csv2hash/yaml_loader.rb +33 -0
- data/lib/csv2hash.rb +28 -8
- data/spec/csv2hash/yaml_loader_spec.rb +20 -0
- data/spec/csv2hash_spec.rb +13 -10
- metadata +56 -1
@@ -0,0 +1,1008 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Csv2hash::Definition
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Csv2hash/Definition.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (D)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Csv2hash.html" title="Csv2hash (module)">Csv2hash</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Definition</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Csv2hash::Definition
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Csv2hash::Definition</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/csv2hash/definition.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
|
103
|
+
<h2>Constant Summary</h2>
|
104
|
+
|
105
|
+
<dl class="constants">
|
106
|
+
|
107
|
+
<dt id="MAPPING-constant" class="">MAPPING =
|
108
|
+
|
109
|
+
</dt>
|
110
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>mapping</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
111
|
+
|
112
|
+
<dt id="COLLECTION-constant" class="">COLLECTION =
|
113
|
+
|
114
|
+
</dt>
|
115
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>collection</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
116
|
+
|
117
|
+
<dt id="TYPES-constant" class="">TYPES =
|
118
|
+
|
119
|
+
</dt>
|
120
|
+
<dd><pre class="code"><span class='lbracket'>[</span> <span class='const'>MAPPING</span><span class='comma'>,</span> <span class='const'>COLLECTION</span> <span class='rbracket'>]</span></pre></dd>
|
121
|
+
|
122
|
+
</dl>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
129
|
+
<ul class="summary">
|
130
|
+
|
131
|
+
<li class="public ">
|
132
|
+
<span class="summary_signature">
|
133
|
+
|
134
|
+
<a href="#cells-instance_method" title="#cells (instance method)">- (Object) <strong>cells</strong> </a>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</span>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<span class="summary_desc"><div class='inline'>
|
152
|
+
<p>Returns the value of attribute cells.</p>
|
153
|
+
</div></span>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
|
158
|
+
<li class="public ">
|
159
|
+
<span class="summary_signature">
|
160
|
+
|
161
|
+
<a href="#header_size-instance_method" title="#header_size (instance method)">- (Object) <strong>header_size</strong> </a>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<span class="summary_desc"><div class='inline'>
|
179
|
+
<p>Returns the value of attribute header_size.</p>
|
180
|
+
</div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
<li class="public ">
|
186
|
+
<span class="summary_signature">
|
187
|
+
|
188
|
+
<a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong> </a>
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
</span>
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<span class="note title readonly">readonly</span>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<span class="summary_desc"><div class='inline'>
|
208
|
+
<p>Returns the value of attribute name.</p>
|
209
|
+
</div></span>
|
210
|
+
|
211
|
+
</li>
|
212
|
+
|
213
|
+
|
214
|
+
<li class="public ">
|
215
|
+
<span class="summary_signature">
|
216
|
+
|
217
|
+
<a href="#structure_rules-instance_method" title="#structure_rules (instance method)">- (Object) <strong>structure_rules</strong> </a>
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
</span>
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
<span class="summary_desc"><div class='inline'>
|
235
|
+
<p>Returns the value of attribute structure_rules.</p>
|
236
|
+
</div></span>
|
237
|
+
|
238
|
+
</li>
|
239
|
+
|
240
|
+
|
241
|
+
<li class="public ">
|
242
|
+
<span class="summary_signature">
|
243
|
+
|
244
|
+
<a href="#type-instance_method" title="#type (instance method)">- (Object) <strong>type</strong> </a>
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</span>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<span class="note title readonly">readonly</span>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
<span class="summary_desc"><div class='inline'>
|
264
|
+
<p>Returns the value of attribute type.</p>
|
265
|
+
</div></span>
|
266
|
+
|
267
|
+
</li>
|
268
|
+
|
269
|
+
|
270
|
+
</ul>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
<h2>
|
277
|
+
Instance Method Summary
|
278
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
279
|
+
</h2>
|
280
|
+
|
281
|
+
<ul class="summary">
|
282
|
+
|
283
|
+
<li class="public ">
|
284
|
+
<span class="summary_signature">
|
285
|
+
|
286
|
+
<a href="#cell-instance_method" title="#cell (instance method)">- (Object) <strong>cell</strong>(*args) </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="#default%21-instance_method" title="#default! (instance method)">- (Object) <strong>default!</strong> </a>
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
</span>
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
|
322
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
323
|
+
|
324
|
+
</li>
|
325
|
+
|
326
|
+
|
327
|
+
<li class="public ">
|
328
|
+
<span class="summary_signature">
|
329
|
+
|
330
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (Definition) <strong>initialize</strong>(name, &blk) </a>
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
</span>
|
335
|
+
|
336
|
+
|
337
|
+
<span class="note title constructor">constructor</span>
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
<span class="summary_desc"><div class='inline'>
|
347
|
+
<p>A new instance of Definition.</p>
|
348
|
+
</div></span>
|
349
|
+
|
350
|
+
</li>
|
351
|
+
|
352
|
+
|
353
|
+
<li class="public ">
|
354
|
+
<span class="summary_signature">
|
355
|
+
|
356
|
+
<a href="#mapping-instance_method" title="#mapping (instance method)">- (Object) <strong>mapping</strong>(&blk) </a>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
</span>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
371
|
+
|
372
|
+
</li>
|
373
|
+
|
374
|
+
|
375
|
+
<li class="public ">
|
376
|
+
<span class="summary_signature">
|
377
|
+
|
378
|
+
<a href="#set_header_size-instance_method" title="#set_header_size (instance method)">- (Object) <strong>set_header_size</strong>(&blk) </a>
|
379
|
+
|
380
|
+
|
381
|
+
|
382
|
+
</span>
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
393
|
+
|
394
|
+
</li>
|
395
|
+
|
396
|
+
|
397
|
+
<li class="public ">
|
398
|
+
<span class="summary_signature">
|
399
|
+
|
400
|
+
<a href="#set_structure_rules-instance_method" title="#set_structure_rules (instance method)">- (Object) <strong>set_structure_rules</strong>(&blk) </a>
|
401
|
+
|
402
|
+
|
403
|
+
|
404
|
+
</span>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
|
412
|
+
|
413
|
+
|
414
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
415
|
+
|
416
|
+
</li>
|
417
|
+
|
418
|
+
|
419
|
+
<li class="public ">
|
420
|
+
<span class="summary_signature">
|
421
|
+
|
422
|
+
<a href="#set_type-instance_method" title="#set_type (instance method)">- (Object) <strong>set_type</strong>(&blk) </a>
|
423
|
+
|
424
|
+
|
425
|
+
|
426
|
+
</span>
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
437
|
+
|
438
|
+
</li>
|
439
|
+
|
440
|
+
|
441
|
+
<li class="public ">
|
442
|
+
<span class="summary_signature">
|
443
|
+
|
444
|
+
<a href="#validate%21-instance_method" title="#validate! (instance method)">- (Object) <strong>validate!</strong> </a>
|
445
|
+
|
446
|
+
|
447
|
+
|
448
|
+
</span>
|
449
|
+
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
459
|
+
|
460
|
+
</li>
|
461
|
+
|
462
|
+
|
463
|
+
</ul>
|
464
|
+
|
465
|
+
|
466
|
+
<div id="constructor_details" class="method_details_list">
|
467
|
+
<h2>Constructor Details</h2>
|
468
|
+
|
469
|
+
<div class="method_details first">
|
470
|
+
<h3 class="signature first" id="initialize-instance_method">
|
471
|
+
|
472
|
+
- (<tt><span class='object_link'><a href="" title="Csv2hash::Definition (class)">Definition</a></span></tt>) <strong>initialize</strong>(name, &blk)
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
</h3><div class="docstring">
|
479
|
+
<div class="discussion">
|
480
|
+
|
481
|
+
<p>Returns a new instance of Definition</p>
|
482
|
+
|
483
|
+
|
484
|
+
</div>
|
485
|
+
</div>
|
486
|
+
<div class="tags">
|
487
|
+
|
488
|
+
|
489
|
+
</div><table class="source_code">
|
490
|
+
<tr>
|
491
|
+
<td>
|
492
|
+
<pre class="lines">
|
493
|
+
|
494
|
+
|
495
|
+
12
|
496
|
+
13
|
497
|
+
14
|
498
|
+
15
|
499
|
+
16
|
500
|
+
17
|
501
|
+
18</pre>
|
502
|
+
</td>
|
503
|
+
<td>
|
504
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 12</span>
|
505
|
+
|
506
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span>
|
507
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
508
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cells'>cells</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
509
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_header_size'>header_size</span> <span class='op'>=</span> <span class='int'>0</span>
|
510
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_structure_rules'>structure_rules</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
511
|
+
<span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
512
|
+
<span class='kw'>end</span></pre>
|
513
|
+
</td>
|
514
|
+
</tr>
|
515
|
+
</table>
|
516
|
+
</div>
|
517
|
+
|
518
|
+
</div>
|
519
|
+
|
520
|
+
<div id="instance_attr_details" class="attr_details">
|
521
|
+
<h2>Instance Attribute Details</h2>
|
522
|
+
|
523
|
+
|
524
|
+
<span id="cells=-instance_method"></span>
|
525
|
+
<div class="method_details first">
|
526
|
+
<h3 class="signature first" id="cells-instance_method">
|
527
|
+
|
528
|
+
- (<tt>Object</tt>) <strong>cells</strong>
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
</h3><div class="docstring">
|
535
|
+
<div class="discussion">
|
536
|
+
|
537
|
+
<p>Returns the value of attribute cells</p>
|
538
|
+
|
539
|
+
|
540
|
+
</div>
|
541
|
+
</div>
|
542
|
+
<div class="tags">
|
543
|
+
|
544
|
+
|
545
|
+
</div><table class="source_code">
|
546
|
+
<tr>
|
547
|
+
<td>
|
548
|
+
<pre class="lines">
|
549
|
+
|
550
|
+
|
551
|
+
9
|
552
|
+
10
|
553
|
+
11</pre>
|
554
|
+
</td>
|
555
|
+
<td>
|
556
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 9</span>
|
557
|
+
|
558
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_cells'>cells</span>
|
559
|
+
<span class='ivar'>@cells</span>
|
560
|
+
<span class='kw'>end</span></pre>
|
561
|
+
</td>
|
562
|
+
</tr>
|
563
|
+
</table>
|
564
|
+
</div>
|
565
|
+
|
566
|
+
|
567
|
+
<span id="header_size=-instance_method"></span>
|
568
|
+
<div class="method_details ">
|
569
|
+
<h3 class="signature " id="header_size-instance_method">
|
570
|
+
|
571
|
+
- (<tt>Object</tt>) <strong>header_size</strong>
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
</h3><div class="docstring">
|
578
|
+
<div class="discussion">
|
579
|
+
|
580
|
+
<p>Returns the value of attribute header_size</p>
|
581
|
+
|
582
|
+
|
583
|
+
</div>
|
584
|
+
</div>
|
585
|
+
<div class="tags">
|
586
|
+
|
587
|
+
|
588
|
+
</div><table class="source_code">
|
589
|
+
<tr>
|
590
|
+
<td>
|
591
|
+
<pre class="lines">
|
592
|
+
|
593
|
+
|
594
|
+
9
|
595
|
+
10
|
596
|
+
11</pre>
|
597
|
+
</td>
|
598
|
+
<td>
|
599
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 9</span>
|
600
|
+
|
601
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_header_size'>header_size</span>
|
602
|
+
<span class='ivar'>@header_size</span>
|
603
|
+
<span class='kw'>end</span></pre>
|
604
|
+
</td>
|
605
|
+
</tr>
|
606
|
+
</table>
|
607
|
+
</div>
|
608
|
+
|
609
|
+
|
610
|
+
<span id=""></span>
|
611
|
+
<div class="method_details ">
|
612
|
+
<h3 class="signature " id="name-instance_method">
|
613
|
+
|
614
|
+
- (<tt>Object</tt>) <strong>name</strong> <span class="extras">(readonly)</span>
|
615
|
+
|
616
|
+
|
617
|
+
|
618
|
+
|
619
|
+
|
620
|
+
</h3><div class="docstring">
|
621
|
+
<div class="discussion">
|
622
|
+
|
623
|
+
<p>Returns the value of attribute name</p>
|
624
|
+
|
625
|
+
|
626
|
+
</div>
|
627
|
+
</div>
|
628
|
+
<div class="tags">
|
629
|
+
|
630
|
+
|
631
|
+
</div><table class="source_code">
|
632
|
+
<tr>
|
633
|
+
<td>
|
634
|
+
<pre class="lines">
|
635
|
+
|
636
|
+
|
637
|
+
10
|
638
|
+
11
|
639
|
+
12</pre>
|
640
|
+
</td>
|
641
|
+
<td>
|
642
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 10</span>
|
643
|
+
|
644
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
645
|
+
<span class='ivar'>@name</span>
|
646
|
+
<span class='kw'>end</span></pre>
|
647
|
+
</td>
|
648
|
+
</tr>
|
649
|
+
</table>
|
650
|
+
</div>
|
651
|
+
|
652
|
+
|
653
|
+
<span id="structure_rules=-instance_method"></span>
|
654
|
+
<div class="method_details ">
|
655
|
+
<h3 class="signature " id="structure_rules-instance_method">
|
656
|
+
|
657
|
+
- (<tt>Object</tt>) <strong>structure_rules</strong>
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
</h3><div class="docstring">
|
664
|
+
<div class="discussion">
|
665
|
+
|
666
|
+
<p>Returns the value of attribute structure_rules</p>
|
667
|
+
|
668
|
+
|
669
|
+
</div>
|
670
|
+
</div>
|
671
|
+
<div class="tags">
|
672
|
+
|
673
|
+
|
674
|
+
</div><table class="source_code">
|
675
|
+
<tr>
|
676
|
+
<td>
|
677
|
+
<pre class="lines">
|
678
|
+
|
679
|
+
|
680
|
+
9
|
681
|
+
10
|
682
|
+
11</pre>
|
683
|
+
</td>
|
684
|
+
<td>
|
685
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 9</span>
|
686
|
+
|
687
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_structure_rules'>structure_rules</span>
|
688
|
+
<span class='ivar'>@structure_rules</span>
|
689
|
+
<span class='kw'>end</span></pre>
|
690
|
+
</td>
|
691
|
+
</tr>
|
692
|
+
</table>
|
693
|
+
</div>
|
694
|
+
|
695
|
+
|
696
|
+
<span id=""></span>
|
697
|
+
<div class="method_details ">
|
698
|
+
<h3 class="signature " id="type-instance_method">
|
699
|
+
|
700
|
+
- (<tt>Object</tt>) <strong>type</strong> <span class="extras">(readonly)</span>
|
701
|
+
|
702
|
+
|
703
|
+
|
704
|
+
|
705
|
+
|
706
|
+
</h3><div class="docstring">
|
707
|
+
<div class="discussion">
|
708
|
+
|
709
|
+
<p>Returns the value of attribute type</p>
|
710
|
+
|
711
|
+
|
712
|
+
</div>
|
713
|
+
</div>
|
714
|
+
<div class="tags">
|
715
|
+
|
716
|
+
|
717
|
+
</div><table class="source_code">
|
718
|
+
<tr>
|
719
|
+
<td>
|
720
|
+
<pre class="lines">
|
721
|
+
|
722
|
+
|
723
|
+
10
|
724
|
+
11
|
725
|
+
12</pre>
|
726
|
+
</td>
|
727
|
+
<td>
|
728
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 10</span>
|
729
|
+
|
730
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_type'>type</span>
|
731
|
+
<span class='ivar'>@type</span>
|
732
|
+
<span class='kw'>end</span></pre>
|
733
|
+
</td>
|
734
|
+
</tr>
|
735
|
+
</table>
|
736
|
+
</div>
|
737
|
+
|
738
|
+
</div>
|
739
|
+
|
740
|
+
|
741
|
+
<div id="instance_method_details" class="method_details_list">
|
742
|
+
<h2>Instance Method Details</h2>
|
743
|
+
|
744
|
+
|
745
|
+
<div class="method_details first">
|
746
|
+
<h3 class="signature first" id="cell-instance_method">
|
747
|
+
|
748
|
+
- (<tt>Object</tt>) <strong>cell</strong>(*args)
|
749
|
+
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
|
754
|
+
</h3><table class="source_code">
|
755
|
+
<tr>
|
756
|
+
<td>
|
757
|
+
<pre class="lines">
|
758
|
+
|
759
|
+
|
760
|
+
24
|
761
|
+
25
|
762
|
+
26</pre>
|
763
|
+
</td>
|
764
|
+
<td>
|
765
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 24</span>
|
766
|
+
|
767
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_cell'>cell</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span>
|
768
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cells'>cells</span> <span class='op'><<</span> <span class='const'>Cell</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
|
769
|
+
<span class='kw'>end</span></pre>
|
770
|
+
</td>
|
771
|
+
</tr>
|
772
|
+
</table>
|
773
|
+
</div>
|
774
|
+
|
775
|
+
<div class="method_details ">
|
776
|
+
<h3 class="signature " id="default!-instance_method">
|
777
|
+
|
778
|
+
- (<tt>Object</tt>) <strong>default!</strong>
|
779
|
+
|
780
|
+
|
781
|
+
|
782
|
+
|
783
|
+
|
784
|
+
</h3><table class="source_code">
|
785
|
+
<tr>
|
786
|
+
<td>
|
787
|
+
<pre class="lines">
|
788
|
+
|
789
|
+
|
790
|
+
48
|
791
|
+
49
|
792
|
+
50
|
793
|
+
51
|
794
|
+
52
|
795
|
+
53
|
796
|
+
54
|
797
|
+
55
|
798
|
+
56
|
799
|
+
57
|
800
|
+
58
|
801
|
+
59
|
802
|
+
60
|
803
|
+
61
|
804
|
+
62
|
805
|
+
63
|
806
|
+
64
|
807
|
+
65
|
808
|
+
66
|
809
|
+
67</pre>
|
810
|
+
</td>
|
811
|
+
<td>
|
812
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 48</span>
|
813
|
+
|
814
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_default!'>default!</span>
|
815
|
+
<span class='id identifier rubyid_cells'>cells</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_cell'>cell</span><span class='op'>|</span>
|
816
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:position</span><span class='rparen'>)</span>
|
817
|
+
|
818
|
+
<span class='id identifier rubyid_default_position'>default_position</span> <span class='id identifier rubyid_cell'>cell</span>
|
819
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:message</span>
|
820
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:values</span>
|
821
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>message:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>:key not supported, please use one of :values</span><span class='tstring_end'>'</span></span>
|
822
|
+
<span class='kw'>else</span>
|
823
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>message:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>undefined :key on :position</span><span class='tstring_end'>'</span></span>
|
824
|
+
<span class='kw'>end</span>
|
825
|
+
<span class='kw'>end</span>
|
826
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>mappable:</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:mappable</span>
|
827
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>type:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>string</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:type</span>
|
828
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>values:</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:values</span>
|
829
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>nested:</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:nested</span>
|
830
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>allow_blank:</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:allow_blank</span>
|
831
|
+
<span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span> <span class='label'>extra_validator:</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_cell'>cell</span><span class='period'>.</span><span class='id identifier rubyid_rules'>rules</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='symbol'>:extra_validator</span>
|
832
|
+
<span class='kw'>end</span>
|
833
|
+
<span class='kw'>end</span></pre>
|
834
|
+
</td>
|
835
|
+
</tr>
|
836
|
+
</table>
|
837
|
+
</div>
|
838
|
+
|
839
|
+
<div class="method_details ">
|
840
|
+
<h3 class="signature " id="mapping-instance_method">
|
841
|
+
|
842
|
+
- (<tt>Object</tt>) <strong>mapping</strong>(&blk)
|
843
|
+
|
844
|
+
|
845
|
+
|
846
|
+
|
847
|
+
|
848
|
+
</h3><table class="source_code">
|
849
|
+
<tr>
|
850
|
+
<td>
|
851
|
+
<pre class="lines">
|
852
|
+
|
853
|
+
|
854
|
+
20
|
855
|
+
21
|
856
|
+
22</pre>
|
857
|
+
</td>
|
858
|
+
<td>
|
859
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 20</span>
|
860
|
+
|
861
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_mapping'>mapping</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span>
|
862
|
+
<span class='id identifier rubyid_instance_eval'>instance_eval</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
863
|
+
<span class='kw'>end</span></pre>
|
864
|
+
</td>
|
865
|
+
</tr>
|
866
|
+
</table>
|
867
|
+
</div>
|
868
|
+
|
869
|
+
<div class="method_details ">
|
870
|
+
<h3 class="signature " id="set_header_size-instance_method">
|
871
|
+
|
872
|
+
- (<tt>Object</tt>) <strong>set_header_size</strong>(&blk)
|
873
|
+
|
874
|
+
|
875
|
+
|
876
|
+
|
877
|
+
|
878
|
+
</h3><table class="source_code">
|
879
|
+
<tr>
|
880
|
+
<td>
|
881
|
+
<pre class="lines">
|
882
|
+
|
883
|
+
|
884
|
+
28
|
885
|
+
29
|
886
|
+
30</pre>
|
887
|
+
</td>
|
888
|
+
<td>
|
889
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 28</span>
|
890
|
+
|
891
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_header_size'>set_header_size</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span>
|
892
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_header_size'>header_size</span> <span class='op'>=</span> <span class='kw'>yield</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
893
|
+
<span class='kw'>end</span></pre>
|
894
|
+
</td>
|
895
|
+
</tr>
|
896
|
+
</table>
|
897
|
+
</div>
|
898
|
+
|
899
|
+
<div class="method_details ">
|
900
|
+
<h3 class="signature " id="set_structure_rules-instance_method">
|
901
|
+
|
902
|
+
- (<tt>Object</tt>) <strong>set_structure_rules</strong>(&blk)
|
903
|
+
|
904
|
+
|
905
|
+
|
906
|
+
|
907
|
+
|
908
|
+
</h3><table class="source_code">
|
909
|
+
<tr>
|
910
|
+
<td>
|
911
|
+
<pre class="lines">
|
912
|
+
|
913
|
+
|
914
|
+
36
|
915
|
+
37
|
916
|
+
38</pre>
|
917
|
+
</td>
|
918
|
+
<td>
|
919
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 36</span>
|
920
|
+
|
921
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_structure_rules'>set_structure_rules</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span>
|
922
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_structure_rules'>structure_rules</span> <span class='op'>=</span> <span class='kw'>yield</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
923
|
+
<span class='kw'>end</span></pre>
|
924
|
+
</td>
|
925
|
+
</tr>
|
926
|
+
</table>
|
927
|
+
</div>
|
928
|
+
|
929
|
+
<div class="method_details ">
|
930
|
+
<h3 class="signature " id="set_type-instance_method">
|
931
|
+
|
932
|
+
- (<tt>Object</tt>) <strong>set_type</strong>(&blk)
|
933
|
+
|
934
|
+
|
935
|
+
|
936
|
+
|
937
|
+
|
938
|
+
</h3><table class="source_code">
|
939
|
+
<tr>
|
940
|
+
<td>
|
941
|
+
<pre class="lines">
|
942
|
+
|
943
|
+
|
944
|
+
32
|
945
|
+
33
|
946
|
+
34</pre>
|
947
|
+
</td>
|
948
|
+
<td>
|
949
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 32</span>
|
950
|
+
|
951
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set_type'>set_type</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span>
|
952
|
+
<span class='ivar'>@type</span> <span class='op'>=</span> <span class='kw'>yield</span> <span class='kw'>if</span> <span class='id identifier rubyid_block_given?'>block_given?</span>
|
953
|
+
<span class='kw'>end</span></pre>
|
954
|
+
</td>
|
955
|
+
</tr>
|
956
|
+
</table>
|
957
|
+
</div>
|
958
|
+
|
959
|
+
<div class="method_details ">
|
960
|
+
<h3 class="signature " id="validate!-instance_method">
|
961
|
+
|
962
|
+
- (<tt>Object</tt>) <strong>validate!</strong>
|
963
|
+
|
964
|
+
|
965
|
+
|
966
|
+
|
967
|
+
|
968
|
+
</h3><table class="source_code">
|
969
|
+
<tr>
|
970
|
+
<td>
|
971
|
+
<pre class="lines">
|
972
|
+
|
973
|
+
|
974
|
+
40
|
975
|
+
41
|
976
|
+
42
|
977
|
+
43
|
978
|
+
44
|
979
|
+
45
|
980
|
+
46</pre>
|
981
|
+
</td>
|
982
|
+
<td>
|
983
|
+
<pre class="code"><span class="info file"># File 'lib/csv2hash/definition.rb', line 40</span>
|
984
|
+
|
985
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_validate!'>validate!</span>
|
986
|
+
<span class='kw'>unless</span> <span class='const'>TYPES</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='ivar'>@type</span><span class='rparen'>)</span>
|
987
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>not suitable type, please use '</span><span class='embexpr_beg'>#{</span><span class='const'>MAPPING</span><span class='embexpr_end'>}</span><span class='tstring_content'>' or '</span><span class='embexpr_beg'>#{</span><span class='const'>COLLECTION</span><span class='embexpr_end'>}</span><span class='tstring_content'>'</span><span class='tstring_end'>"</span></span>
|
988
|
+
<span class='kw'>end</span>
|
989
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>cells must be an Array of cell</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_cells'>cells</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Array</span>
|
990
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>structure rules must be a Hash of rules</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_structure_rules'>structure_rules</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span> <span class='op'>==</span> <span class='const'>Hash</span>
|
991
|
+
<span class='kw'>end</span></pre>
|
992
|
+
</td>
|
993
|
+
</tr>
|
994
|
+
</table>
|
995
|
+
</div>
|
996
|
+
|
997
|
+
</div>
|
998
|
+
|
999
|
+
</div>
|
1000
|
+
|
1001
|
+
<div id="footer">
|
1002
|
+
Generated on Fri Aug 29 17:12:27 2014 by
|
1003
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1004
|
+
0.8.7.4 (ruby-2.1.2).
|
1005
|
+
</div>
|
1006
|
+
|
1007
|
+
</body>
|
1008
|
+
</html>
|