csv_decision 0.0.3 → 0.0.4

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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +2 -0
  3. data/.gitignore +2 -1
  4. data/.travis.yml +2 -3
  5. data/CHANGELOG.md +19 -1
  6. data/README.md +49 -16
  7. data/{benchmark.rb → benchmarks/rufus_decision.rb} +1 -1
  8. data/csv_decision.gemspec +1 -1
  9. data/doc/CSVDecision/CellValidationError.html +143 -0
  10. data/doc/CSVDecision/Columns/Default.html +409 -0
  11. data/doc/CSVDecision/Columns/Dictionary.html +410 -0
  12. data/doc/CSVDecision/Columns/Entry.html +321 -0
  13. data/doc/CSVDecision/Columns.html +476 -0
  14. data/doc/CSVDecision/Constant.html +295 -0
  15. data/doc/CSVDecision/Data.html +344 -0
  16. data/doc/CSVDecision/Decide.html +434 -0
  17. data/doc/CSVDecision/Decision.html +604 -0
  18. data/doc/CSVDecision/Error.html +139 -0
  19. data/doc/CSVDecision/FileError.html +143 -0
  20. data/doc/CSVDecision/Function.html +229 -0
  21. data/doc/CSVDecision/Header.html +520 -0
  22. data/doc/CSVDecision/Input.html +305 -0
  23. data/doc/CSVDecision/Load.html +225 -0
  24. data/doc/CSVDecision/Matchers/Constant.html +242 -0
  25. data/doc/CSVDecision/Matchers/Function.html +342 -0
  26. data/doc/CSVDecision/Matchers/Matcher.html +325 -0
  27. data/doc/CSVDecision/Matchers/Numeric.html +277 -0
  28. data/doc/CSVDecision/Matchers/Pattern.html +600 -0
  29. data/doc/CSVDecision/Matchers/Range.html +413 -0
  30. data/doc/CSVDecision/Matchers/Symbol.html +280 -0
  31. data/doc/CSVDecision/Matchers.html +1529 -0
  32. data/doc/CSVDecision/Numeric.html +259 -0
  33. data/doc/CSVDecision/Options.html +445 -0
  34. data/doc/CSVDecision/Parse.html +270 -0
  35. data/doc/CSVDecision/ScanRow.html +746 -0
  36. data/doc/CSVDecision/Symbol.html +256 -0
  37. data/doc/CSVDecision/Table.html +1115 -0
  38. data/doc/CSVDecision.html +652 -0
  39. data/doc/_index.html +410 -0
  40. data/doc/class_list.html +51 -0
  41. data/doc/css/common.css +1 -0
  42. data/doc/css/full_list.css +58 -0
  43. data/doc/css/style.css +499 -0
  44. data/doc/file.README.html +264 -0
  45. data/doc/file_list.html +56 -0
  46. data/doc/frames.html +17 -0
  47. data/doc/index.html +264 -0
  48. data/doc/js/app.js +248 -0
  49. data/doc/js/full_list.js +216 -0
  50. data/doc/js/jquery.js +4 -0
  51. data/doc/method_list.html +683 -0
  52. data/doc/top-level-namespace.html +110 -0
  53. data/lib/csv_decision/columns.rb +15 -12
  54. data/lib/csv_decision/constant.rb +54 -0
  55. data/lib/csv_decision/decide.rb +5 -5
  56. data/lib/csv_decision/decision.rb +3 -1
  57. data/lib/csv_decision/function.rb +32 -0
  58. data/lib/csv_decision/header.rb +27 -18
  59. data/lib/csv_decision/input.rb +11 -8
  60. data/lib/csv_decision/matchers/constant.rb +18 -0
  61. data/lib/csv_decision/matchers/function.rb +11 -44
  62. data/lib/csv_decision/matchers/numeric.rb +5 -33
  63. data/lib/csv_decision/matchers/pattern.rb +26 -11
  64. data/lib/csv_decision/matchers/range.rb +21 -5
  65. data/lib/csv_decision/matchers/symbol.rb +20 -0
  66. data/lib/csv_decision/matchers.rb +85 -20
  67. data/lib/csv_decision/numeric.rb +38 -0
  68. data/lib/csv_decision/options.rb +36 -27
  69. data/lib/csv_decision/parse.rb +46 -39
  70. data/lib/csv_decision/scan_row.rb +19 -7
  71. data/lib/csv_decision/symbol.rb +73 -0
  72. data/lib/csv_decision/table.rb +24 -18
  73. data/lib/csv_decision.rb +25 -18
  74. data/spec/csv_decision/columns_spec.rb +1 -1
  75. data/spec/csv_decision/constant_spec.rb +60 -0
  76. data/spec/csv_decision/examples_spec.rb +119 -0
  77. data/spec/csv_decision/matchers/function_spec.rb +48 -28
  78. data/spec/csv_decision/matchers/numeric_spec.rb +4 -41
  79. data/spec/csv_decision/matchers/range_spec.rb +31 -61
  80. data/spec/csv_decision/matchers/symbol_spec.rb +65 -0
  81. data/spec/csv_decision/options_spec.rb +14 -2
  82. data/spec/csv_decision/parse_spec.rb +10 -0
  83. data/spec/csv_decision/table_spec.rb +112 -6
  84. data/spec/data/valid/simple_constants.csv +3 -3
  85. metadata +62 -7
  86. data/spec/csv_decision/simple_example_spec.rb +0 -75
  87. /data/spec/{csv_decision.rb → csv_decision_spec.rb} +0 -0
@@ -0,0 +1,600 @@
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: CSVDecision::Matchers::Pattern
8
+
9
+ &mdash; Documentation by YARD 0.9.12
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
+ pathId = "CSVDecision::Matchers::Pattern";
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 (P)</a> &raquo;
40
+ <span class='title'><span class='object_link'><a href="../../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span>
41
+ &raquo;
42
+ <span class="title">Pattern</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: CSVDecision::Matchers::Pattern
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName"><span class='object_link'><a href="Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matcher</a></span></span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next"><span class='object_link'><a href="Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matcher</a></span></li>
78
+
79
+ <li class="next">CSVDecision::Matchers::Pattern</li>
80
+
81
+ </ul>
82
+ <a href="#" class="inheritanceTree">show all</a>
83
+
84
+ </dd>
85
+ </dl>
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <dl>
98
+ <dt>Defined in:</dt>
99
+ <dd>lib/csv_decision/matchers/pattern.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>Match cell against a regular expression pattern - e.g., <tt>=~ hot|col</tt> or
108
+ <tt>.<strong>OPT.</strong></tt></p>
109
+
110
+
111
+ </div>
112
+ </div>
113
+ <div class="tags">
114
+
115
+
116
+ </div>
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <h2>
125
+ Class Method Summary
126
+ <small><a href="#" class="summary_toggle">collapse</a></small>
127
+ </h2>
128
+
129
+ <ul class="summary">
130
+
131
+ <li class="public ">
132
+ <span class="summary_signature">
133
+
134
+ <a href="#matches%3F-class_method" title="matches? (class method)">.<strong>matches?</strong>(cell, regexp_explicit:) &#x21d2; Boolean </a>
135
+
136
+
137
+
138
+ </span>
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+ <span class="summary_desc"><div class='inline'></div></span>
149
+
150
+ </li>
151
+
152
+
153
+ <li class="public ">
154
+ <span class="summary_signature">
155
+
156
+ <a href="#parse-class_method" title="parse (class method)">.<strong>parse</strong>(comparator:, value:) &#x21d2; Object </a>
157
+
158
+
159
+
160
+ </span>
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+ <span class="summary_desc"><div class='inline'></div></span>
171
+
172
+ </li>
173
+
174
+
175
+ <li class="public ">
176
+ <span class="summary_signature">
177
+
178
+ <a href="#regexp_implicit-class_method" title="regexp_implicit (class method)">.<strong>regexp_implicit</strong>(value) &#x21d2; Object </a>
179
+
180
+
181
+
182
+ </span>
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ <span class="summary_desc"><div class='inline'></div></span>
193
+
194
+ </li>
195
+
196
+
197
+ </ul>
198
+
199
+ <h2>
200
+ Instance Method Summary
201
+ <small><a href="#" class="summary_toggle">collapse</a></small>
202
+ </h2>
203
+
204
+ <ul class="summary">
205
+
206
+ <li class="public ">
207
+ <span class="summary_signature">
208
+
209
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(options = {}) &#x21d2; Pattern </a>
210
+
211
+
212
+
213
+ </span>
214
+
215
+
216
+ <span class="note title constructor">constructor</span>
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ <span class="summary_desc"><div class='inline'>
226
+ <p>A new instance of Pattern.</p>
227
+ </div></span>
228
+
229
+ </li>
230
+
231
+
232
+ <li class="public ">
233
+ <span class="summary_signature">
234
+
235
+ <a href="#matches%3F-instance_method" title="#matches? (instance method)">#<strong>matches?</strong>(cell) &#x21d2; false, CSVDecision::Proc </a>
236
+
237
+
238
+
239
+ </span>
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+ <span class="summary_desc"><div class='inline'>
250
+ <p>Recognise a regular expression pattern - e.g., <tt>=~ on|off</tt> or <tt>!~ OPT.*</tt>.</p>
251
+ </div></span>
252
+
253
+ </li>
254
+
255
+
256
+ </ul>
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+ <div id="constructor_details" class="method_details_list">
266
+ <h2>Constructor Details</h2>
267
+
268
+ <div class="method_details first">
269
+ <h3 class="signature first" id="initialize-instance_method">
270
+
271
+ #<strong>initialize</strong>(options = {}) &#x21d2; <tt><span class='object_link'><a href="" title="CSVDecision::Matchers::Pattern (class)">Pattern</a></span></tt>
272
+
273
+
274
+
275
+
276
+
277
+ </h3><div class="docstring">
278
+ <div class="discussion">
279
+
280
+ <p>Returns a new instance of Pattern</p>
281
+
282
+
283
+ </div>
284
+ </div>
285
+ <div class="tags">
286
+ <p class="tag_title">Parameters:</p>
287
+ <ul class="param">
288
+
289
+ <li>
290
+
291
+ <span class='name'>options</span>
292
+
293
+
294
+ <span class='type'>(<tt>Hash{<span class='object_link'><a href="Symbol.html" title="CSVDecision::Matchers::Symbol (class)">Symbol</a></span>=&gt;Object}</tt>)</span>
295
+
296
+
297
+ <em class="default">(defaults to: <tt>{}</tt>)</em>
298
+
299
+
300
+ &mdash;
301
+ <div class='inline'>
302
+ <p>Used to determine the value of regexp_implicit:.</p>
303
+ </div>
304
+
305
+ </li>
306
+
307
+ </ul>
308
+
309
+
310
+ </div><table class="source_code">
311
+ <tr>
312
+ <td>
313
+ <pre class="lines">
314
+
315
+
316
+ 76
317
+ 77
318
+ 78
319
+ 79</pre>
320
+ </td>
321
+ <td>
322
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 76</span>
323
+
324
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
325
+ <span class='comment'># By default regexp&#39;s must have an explicit comparator
326
+ </span> <span class='ivar'>@regexp_explicit</span> <span class='op'>=</span> <span class='op'>!</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:regexp_implicit</span><span class='rbracket'>]</span>
327
+ <span class='kw'>end</span></pre>
328
+ </td>
329
+ </tr>
330
+ </table>
331
+ </div>
332
+
333
+ </div>
334
+
335
+
336
+ <div id="class_method_details" class="method_details_list">
337
+ <h2>Class Method Details</h2>
338
+
339
+
340
+ <div class="method_details first">
341
+ <h3 class="signature first" id="matches?-class_method">
342
+
343
+ .<strong>matches?</strong>(cell, regexp_explicit:) &#x21d2; <tt>Boolean</tt>
344
+
345
+
346
+
347
+
348
+
349
+ </h3><div class="docstring">
350
+ <div class="discussion">
351
+
352
+
353
+ </div>
354
+ </div>
355
+ <div class="tags">
356
+
357
+ <p class="tag_title">Returns:</p>
358
+ <ul class="return">
359
+
360
+ <li>
361
+
362
+
363
+ <span class='type'>(<tt>Boolean</tt>)</span>
364
+
365
+
366
+
367
+ </li>
368
+
369
+ </ul>
370
+
371
+ </div><table class="source_code">
372
+ <tr>
373
+ <td>
374
+ <pre class="lines">
375
+
376
+
377
+ 62
378
+ 63
379
+ 64
380
+ 65
381
+ 66
382
+ 67
383
+ 68
384
+ 69
385
+ 70
386
+ 71
387
+ 72
388
+ 73</pre>
389
+ </td>
390
+ <td>
391
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 62</span>
392
+
393
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='comma'>,</span> <span class='label'>regexp_explicit:</span><span class='rparen'>)</span>
394
+ <span class='id identifier rubyid_comparator'>comparator</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='id identifier rubyid_regexp?'>regexp?</span><span class='lparen'>(</span><span class='label'>cell:</span> <span class='id identifier rubyid_cell'>cell</span><span class='comma'>,</span> <span class='label'>explicit:</span> <span class='id identifier rubyid_regexp_explicit'>regexp_explicit</span><span class='rparen'>)</span>
395
+
396
+ <span class='comment'># We could not find a regexp pattern - maybe it&#39;s a simple string or something else?
397
+ </span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_comparator'>comparator</span>
398
+
399
+ <span class='comment'># No need for a regular expression if we have simple string inequality
400
+ </span> <span class='id identifier rubyid_pattern'>pattern</span> <span class='op'>=</span> <span class='id identifier rubyid_comparator'>comparator</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>!=</span><span class='tstring_end'>&#39;</span></span> <span class='op'>?</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>:</span> <span class='const'><span class='object_link'><a href="../Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span><span class='period'>.</span><span class='id identifier rubyid_regexp'><span class='object_link'><a href="../Matchers.html#regexp-class_method" title="CSVDecision::Matchers.regexp (method)">regexp</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
401
+
402
+ <span class='const'><span class='object_link'><a href="../../CSVDecision.html#Proc-constant" title="CSVDecision::Proc (constant)">Proc</a></span></span><span class='period'>.</span><span class='id identifier rubyid_with'>with</span><span class='lparen'>(</span><span class='label'>type:</span> <span class='symbol'>:proc</span><span class='comma'>,</span>
403
+ <span class='label'>function:</span> <span class='const'>PATTERN_LAMBDAS</span><span class='lbracket'>[</span><span class='id identifier rubyid_comparator'>comparator</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_curry'>curry</span><span class='lbracket'>[</span><span class='id identifier rubyid_pattern'>pattern</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span><span class='rparen'>)</span>
404
+ <span class='kw'>end</span></pre>
405
+ </td>
406
+ </tr>
407
+ </table>
408
+ </div>
409
+
410
+ <div class="method_details ">
411
+ <h3 class="signature " id="parse-class_method">
412
+
413
+ .<strong>parse</strong>(comparator:, value:) &#x21d2; <tt>Object</tt>
414
+
415
+
416
+
417
+
418
+
419
+ </h3><table class="source_code">
420
+ <tr>
421
+ <td>
422
+ <pre class="lines">
423
+
424
+
425
+ 40
426
+ 41
427
+ 42
428
+ 43
429
+ 44
430
+ 45
431
+ 46
432
+ 47
433
+ 48
434
+ 49
435
+ 50
436
+ 51</pre>
437
+ </td>
438
+ <td>
439
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 40</span>
440
+
441
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='label'>comparator:</span><span class='comma'>,</span> <span class='label'>value:</span><span class='rparen'>)</span>
442
+ <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
443
+
444
+ <span class='comment'># We cannot do a regexp comparison against a symbol name.
445
+ </span> <span class='comment'># (Maybe we should add this feature?)
446
+ </span> <span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_value'>value</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>:</span><span class='tstring_end'>&#39;</span></span>
447
+
448
+ <span class='comment'># If no comparator then the implicit option must be on
449
+ </span> <span class='id identifier rubyid_comparator'>comparator</span> <span class='op'>=</span> <span class='id identifier rubyid_regexp_implicit'>regexp_implicit</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_comparator'>comparator</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
450
+
451
+ <span class='lbracket'>[</span><span class='id identifier rubyid_comparator'>comparator</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rbracket'>]</span>
452
+ <span class='kw'>end</span></pre>
453
+ </td>
454
+ </tr>
455
+ </table>
456
+ </div>
457
+
458
+ <div class="method_details ">
459
+ <h3 class="signature " id="regexp_implicit-class_method">
460
+
461
+ .<strong>regexp_implicit</strong>(value) &#x21d2; <tt>Object</tt>
462
+
463
+
464
+
465
+
466
+
467
+ </h3><table class="source_code">
468
+ <tr>
469
+ <td>
470
+ <pre class="lines">
471
+
472
+
473
+ 53
474
+ 54
475
+ 55
476
+ 56
477
+ 57
478
+ 58
479
+ 59
480
+ 60</pre>
481
+ </td>
482
+ <td>
483
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 53</span>
484
+
485
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_regexp_implicit'>regexp_implicit</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
486
+ <span class='comment'># rubocop: disable Style/CaseEquality
487
+ </span> <span class='kw'>return</span> <span class='kw'>unless</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\W</span><span class='regexp_end'>/</span></span> <span class='op'>===</span> <span class='id identifier rubyid_value'>value</span>
488
+ <span class='comment'># rubocop: enable Style/CaseEquality
489
+ </span>
490
+ <span class='comment'># Make the implict comparator explict
491
+ </span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>=~</span><span class='tstring_end'>&#39;</span></span>
492
+ <span class='kw'>end</span></pre>
493
+ </td>
494
+ </tr>
495
+ </table>
496
+ </div>
497
+
498
+ </div>
499
+
500
+ <div id="instance_method_details" class="method_details_list">
501
+ <h2>Instance Method Details</h2>
502
+
503
+
504
+ <div class="method_details first">
505
+ <h3 class="signature first" id="matches?-instance_method">
506
+
507
+ #<strong>matches?</strong>(cell) &#x21d2; <tt>false</tt>, <tt><span class='object_link'><a href="../../CSVDecision.html#Proc-constant" title="CSVDecision::Proc (constant)">CSVDecision::Proc</a></span></tt>
508
+
509
+
510
+
511
+
512
+
513
+ </h3><div class="docstring">
514
+ <div class="discussion">
515
+
516
+ <p>Recognise a regular expression pattern - e.g., <tt>=~ on|off</tt> or <tt>!~ OPT.*</tt>.
517
+ If the option regexp_implicit: true has been set, then cells may omit the
518
+ <tt>=~</tt> comparator so long as they contain non-word characters typically used
519
+ in regular expressions such as <tt>*</tt> and <code>.</code>.</p>
520
+
521
+
522
+ </div>
523
+ </div>
524
+ <div class="tags">
525
+ <p class="tag_title">Parameters:</p>
526
+ <ul class="param">
527
+
528
+ <li>
529
+
530
+ <span class='name'>cell</span>
531
+
532
+
533
+ <span class='type'>(<tt>String</tt>)</span>
534
+
535
+
536
+
537
+ &mdash;
538
+ <div class='inline'>
539
+ <p>Data row cell.</p>
540
+ </div>
541
+
542
+ </li>
543
+
544
+ </ul>
545
+
546
+ <p class="tag_title">Returns:</p>
547
+ <ul class="return">
548
+
549
+ <li>
550
+
551
+
552
+ <span class='type'>(<tt>false</tt>, <tt><span class='object_link'><a href="../../CSVDecision.html#Proc-constant" title="CSVDecision::Proc (constant)">CSVDecision::Proc</a></span></tt>)</span>
553
+
554
+
555
+
556
+ &mdash;
557
+ <div class='inline'>
558
+ <p>Returns false if this cell is not a match; otherwise returns the
559
+ <code>CSVDecision::Proc</code> object indicating if this is a constant or
560
+ some type of function.</p>
561
+ </div>
562
+
563
+ </li>
564
+
565
+ </ul>
566
+
567
+ </div><table class="source_code">
568
+ <tr>
569
+ <td>
570
+ <pre class="lines">
571
+
572
+
573
+ 86
574
+ 87
575
+ 88</pre>
576
+ </td>
577
+ <td>
578
+ <pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 86</span>
579
+
580
+ <span class='kw'>def</span> <span class='id identifier rubyid_matches?'>matches?</span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='rparen'>)</span>
581
+ <span class='const'><span class='object_link'><a href="" title="CSVDecision::Matchers::Pattern (class)">Pattern</a></span></span><span class='period'>.</span><span class='id identifier rubyid_matches?'><span class='object_link'><a href="#matches%3F-class_method" title="CSVDecision::Matchers::Pattern.matches? (method)">matches?</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_cell'>cell</span><span class='comma'>,</span> <span class='label'>regexp_explicit:</span> <span class='ivar'>@regexp_explicit</span><span class='rparen'>)</span>
582
+ <span class='kw'>end</span></pre>
583
+ </td>
584
+ </tr>
585
+ </table>
586
+ </div>
587
+
588
+ </div>
589
+
590
+ </div>
591
+
592
+ <div id="footer">
593
+ Generated on Tue Dec 26 18:31:38 2017 by
594
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
595
+ 0.9.12 (ruby-2.3.0).
596
+ </div>
597
+
598
+ </div>
599
+ </body>
600
+ </html>