csv_decision2 0.5.1
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 +7 -0
- data/.codeclimate.yml +3 -0
- data/.coveralls.yml +2 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +85 -0
- data/Dockerfile +6 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +356 -0
- data/benchmarks/rufus_decision.rb +158 -0
- data/csv_decision2.gemspec +38 -0
- data/doc/CSVDecision/CellValidationError.html +143 -0
- data/doc/CSVDecision/Columns/Default.html +589 -0
- data/doc/CSVDecision/Columns/Dictionary.html +801 -0
- data/doc/CSVDecision/Columns/Entry.html +508 -0
- data/doc/CSVDecision/Columns.html +1259 -0
- data/doc/CSVDecision/Constant.html +254 -0
- data/doc/CSVDecision/Data.html +479 -0
- data/doc/CSVDecision/Decide.html +302 -0
- data/doc/CSVDecision/Decision.html +1011 -0
- data/doc/CSVDecision/Defaults.html +291 -0
- data/doc/CSVDecision/Dictionary/Entry.html +1147 -0
- data/doc/CSVDecision/Dictionary.html +426 -0
- data/doc/CSVDecision/Error.html +139 -0
- data/doc/CSVDecision/FileError.html +143 -0
- data/doc/CSVDecision/Function.html +240 -0
- data/doc/CSVDecision/Guard.html +245 -0
- data/doc/CSVDecision/Header.html +647 -0
- data/doc/CSVDecision/Index.html +741 -0
- data/doc/CSVDecision/Input.html +404 -0
- data/doc/CSVDecision/Load.html +296 -0
- data/doc/CSVDecision/Matchers/Constant.html +484 -0
- data/doc/CSVDecision/Matchers/Function.html +511 -0
- data/doc/CSVDecision/Matchers/Guard.html +503 -0
- data/doc/CSVDecision/Matchers/Matcher.html +507 -0
- data/doc/CSVDecision/Matchers/Numeric.html +415 -0
- data/doc/CSVDecision/Matchers/Pattern.html +491 -0
- data/doc/CSVDecision/Matchers/Proc.html +704 -0
- data/doc/CSVDecision/Matchers/Range.html +379 -0
- data/doc/CSVDecision/Matchers/Symbol.html +426 -0
- data/doc/CSVDecision/Matchers.html +1567 -0
- data/doc/CSVDecision/Numeric.html +259 -0
- data/doc/CSVDecision/Options.html +443 -0
- data/doc/CSVDecision/Parse.html +282 -0
- data/doc/CSVDecision/Paths.html +742 -0
- data/doc/CSVDecision/Result.html +1200 -0
- data/doc/CSVDecision/Scan/InputHashes.html +369 -0
- data/doc/CSVDecision/Scan.html +313 -0
- data/doc/CSVDecision/ScanRow.html +866 -0
- data/doc/CSVDecision/Symbol.html +256 -0
- data/doc/CSVDecision/Table.html +1470 -0
- data/doc/CSVDecision/TableValidationError.html +143 -0
- data/doc/CSVDecision/Validate.html +422 -0
- data/doc/CSVDecision.html +621 -0
- data/doc/_index.html +471 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +499 -0
- data/doc/file.README.html +421 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +421 -0
- data/doc/js/app.js +248 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +1163 -0
- data/doc/top-level-namespace.html +110 -0
- data/docker-compose.yml +13 -0
- data/lib/csv_decision/columns.rb +192 -0
- data/lib/csv_decision/data.rb +92 -0
- data/lib/csv_decision/decision.rb +196 -0
- data/lib/csv_decision/defaults.rb +47 -0
- data/lib/csv_decision/dictionary.rb +180 -0
- data/lib/csv_decision/header.rb +83 -0
- data/lib/csv_decision/index.rb +107 -0
- data/lib/csv_decision/input.rb +121 -0
- data/lib/csv_decision/load.rb +36 -0
- data/lib/csv_decision/matchers/constant.rb +74 -0
- data/lib/csv_decision/matchers/function.rb +56 -0
- data/lib/csv_decision/matchers/guard.rb +142 -0
- data/lib/csv_decision/matchers/numeric.rb +44 -0
- data/lib/csv_decision/matchers/pattern.rb +94 -0
- data/lib/csv_decision/matchers/range.rb +95 -0
- data/lib/csv_decision/matchers/symbol.rb +149 -0
- data/lib/csv_decision/matchers.rb +220 -0
- data/lib/csv_decision/options.rb +124 -0
- data/lib/csv_decision/parse.rb +165 -0
- data/lib/csv_decision/paths.rb +78 -0
- data/lib/csv_decision/result.rb +204 -0
- data/lib/csv_decision/scan.rb +117 -0
- data/lib/csv_decision/scan_row.rb +142 -0
- data/lib/csv_decision/table.rb +101 -0
- data/lib/csv_decision/validate.rb +85 -0
- data/lib/csv_decision.rb +45 -0
- data/spec/csv_decision/columns_spec.rb +251 -0
- data/spec/csv_decision/constant_spec.rb +36 -0
- data/spec/csv_decision/data_spec.rb +50 -0
- data/spec/csv_decision/decision_spec.rb +19 -0
- data/spec/csv_decision/examples_spec.rb +242 -0
- data/spec/csv_decision/index_spec.rb +58 -0
- data/spec/csv_decision/input_spec.rb +55 -0
- data/spec/csv_decision/load_spec.rb +28 -0
- data/spec/csv_decision/matchers/function_spec.rb +82 -0
- data/spec/csv_decision/matchers/guard_spec.rb +170 -0
- data/spec/csv_decision/matchers/numeric_spec.rb +47 -0
- data/spec/csv_decision/matchers/pattern_spec.rb +183 -0
- data/spec/csv_decision/matchers/range_spec.rb +70 -0
- data/spec/csv_decision/matchers/symbol_spec.rb +67 -0
- data/spec/csv_decision/options_spec.rb +94 -0
- data/spec/csv_decision/parse_spec.rb +44 -0
- data/spec/csv_decision/table_spec.rb +683 -0
- data/spec/csv_decision_spec.rb +7 -0
- data/spec/data/invalid/empty.csv +0 -0
- data/spec/data/invalid/invalid_header1.csv +4 -0
- data/spec/data/invalid/invalid_header2.csv +4 -0
- data/spec/data/invalid/invalid_header3.csv +4 -0
- data/spec/data/invalid/invalid_header4.csv +4 -0
- data/spec/data/valid/benchmark_regexp.csv +10 -0
- data/spec/data/valid/index_example.csv +13 -0
- data/spec/data/valid/multi_column_index.csv +10 -0
- data/spec/data/valid/multi_column_index2.csv +12 -0
- data/spec/data/valid/options_in_file1.csv +5 -0
- data/spec/data/valid/options_in_file2.csv +5 -0
- data/spec/data/valid/options_in_file3.csv +13 -0
- data/spec/data/valid/regular_expressions.csv +11 -0
- data/spec/data/valid/simple_constants.csv +5 -0
- data/spec/data/valid/simple_example.csv +10 -0
- data/spec/data/valid/valid.csv +4 -0
- data/spec/spec_helper.rb +106 -0
- metadata +352 -0
@@ -0,0 +1,491 @@
|
|
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
|
+
— 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> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../CSVDecision.html" title="CSVDecision (module)">CSVDecision</a></span></span> » <span class='title'><span class='object_link'><a href="../Matchers.html" title="CSVDecision::Matchers (class)">Matchers</a></span></span>
|
41
|
+
»
|
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
|
+
<span class="private note title">Private</span>
|
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
|
+
<p class="note private">
|
107
|
+
<strong>This class is part of a private API.</strong>
|
108
|
+
You should avoid using this class if possible, as it may be removed or be changed in the future.
|
109
|
+
</p>
|
110
|
+
|
111
|
+
<p>Match cell against a regular expression pattern - e.g., <tt>=~ hot|col</tt> or
|
112
|
+
<tt>.<strong>OPT.</strong></tt></p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<h2>
|
129
|
+
Class Method Summary
|
130
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
131
|
+
</h2>
|
132
|
+
|
133
|
+
<ul class="summary">
|
134
|
+
|
135
|
+
<li class="public ">
|
136
|
+
<span class="summary_signature">
|
137
|
+
|
138
|
+
<a href="#matches%3F-class_method" title="matches? (class method)">.<strong>matches?</strong>(cell, regexp_explicit:) ⇒ Boolean </a>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</span>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<span class="private note title">private</span>
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'>
|
153
|
+
<p>(see Pattern#matches).</p>
|
154
|
+
</div></span>
|
155
|
+
|
156
|
+
</li>
|
157
|
+
|
158
|
+
|
159
|
+
</ul>
|
160
|
+
|
161
|
+
<h2>
|
162
|
+
Instance Method Summary
|
163
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
164
|
+
</h2>
|
165
|
+
|
166
|
+
<ul class="summary">
|
167
|
+
|
168
|
+
<li class="public ">
|
169
|
+
<span class="summary_signature">
|
170
|
+
|
171
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(options = {}) ⇒ Pattern </a>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
</span>
|
176
|
+
|
177
|
+
|
178
|
+
<span class="note title constructor">constructor</span>
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
<span class="private note title">private</span>
|
185
|
+
|
186
|
+
|
187
|
+
<span class="summary_desc"><div class='inline'>
|
188
|
+
<p>A new instance of Pattern.</p>
|
189
|
+
</div></span>
|
190
|
+
|
191
|
+
</li>
|
192
|
+
|
193
|
+
|
194
|
+
<li class="public ">
|
195
|
+
<span class="summary_signature">
|
196
|
+
|
197
|
+
<a href="#matches%3F-instance_method" title="#matches? (instance method)">#<strong>matches?</strong>(cell) ⇒ false, CSVDecision::Proc </a>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
</span>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
<span class="private note title">private</span>
|
209
|
+
|
210
|
+
|
211
|
+
<span class="summary_desc"><div class='inline'>
|
212
|
+
<p>Recognise a regular expression pattern - e.g., <tt>=~ on|off</tt> or <tt>!~ OPT.*</tt>.</p>
|
213
|
+
</div></span>
|
214
|
+
|
215
|
+
</li>
|
216
|
+
|
217
|
+
|
218
|
+
</ul>
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Matcher.html" title="CSVDecision::Matchers::Matcher (class)">Matcher</a></span></h3>
|
231
|
+
<p class="inherited"><span class='object_link'><a href="Matcher.html#ins%3F-instance_method" title="CSVDecision::Matchers::Matcher#ins? (method)">#ins?</a></span>, <span class='object_link'><a href="Matcher.html#outs%3F-instance_method" title="CSVDecision::Matchers::Matcher#outs? (method)">#outs?</a></span></p>
|
232
|
+
<div id="constructor_details" class="method_details_list">
|
233
|
+
<h2>Constructor Details</h2>
|
234
|
+
|
235
|
+
<div class="method_details first">
|
236
|
+
<h3 class="signature first" id="initialize-instance_method">
|
237
|
+
|
238
|
+
#<strong>initialize</strong>(options = {}) ⇒ <tt><span class='object_link'><a href="" title="CSVDecision::Matchers::Pattern (class)">Pattern</a></span></tt>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
</h3><div class="docstring">
|
245
|
+
<div class="discussion">
|
246
|
+
<p class="note private">
|
247
|
+
<strong>This method is part of a private API.</strong>
|
248
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
249
|
+
</p>
|
250
|
+
|
251
|
+
<p>Returns a new instance of Pattern</p>
|
252
|
+
|
253
|
+
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
<div class="tags">
|
257
|
+
<p class="tag_title">Parameters:</p>
|
258
|
+
<ul class="param">
|
259
|
+
|
260
|
+
<li>
|
261
|
+
|
262
|
+
<span class='name'>options</span>
|
263
|
+
|
264
|
+
|
265
|
+
<span class='type'>(<tt>Hash{<span class='object_link'><a href="Symbol.html" title="CSVDecision::Matchers::Symbol (class)">Symbol</a></span>=>Object}</tt>)</span>
|
266
|
+
|
267
|
+
|
268
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
269
|
+
|
270
|
+
|
271
|
+
—
|
272
|
+
<div class='inline'>
|
273
|
+
<p>Used to determine the value of regexp_implicit:.</p>
|
274
|
+
</div>
|
275
|
+
|
276
|
+
</li>
|
277
|
+
|
278
|
+
</ul>
|
279
|
+
|
280
|
+
|
281
|
+
</div><table class="source_code">
|
282
|
+
<tr>
|
283
|
+
<td>
|
284
|
+
<pre class="lines">
|
285
|
+
|
286
|
+
|
287
|
+
78
|
288
|
+
79
|
289
|
+
80
|
290
|
+
81</pre>
|
291
|
+
</td>
|
292
|
+
<td>
|
293
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 78</span>
|
294
|
+
|
295
|
+
<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>
|
296
|
+
<span class='comment'># By default regexp's must have an explicit comparator.
|
297
|
+
</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>
|
298
|
+
<span class='kw'>end</span></pre>
|
299
|
+
</td>
|
300
|
+
</tr>
|
301
|
+
</table>
|
302
|
+
</div>
|
303
|
+
|
304
|
+
</div>
|
305
|
+
|
306
|
+
|
307
|
+
<div id="class_method_details" class="method_details_list">
|
308
|
+
<h2>Class Method Details</h2>
|
309
|
+
|
310
|
+
|
311
|
+
<div class="method_details first">
|
312
|
+
<h3 class="signature first" id="matches?-class_method">
|
313
|
+
|
314
|
+
.<strong>matches?</strong>(cell, regexp_explicit:) ⇒ <tt>Boolean</tt>
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
|
320
|
+
</h3><div class="docstring">
|
321
|
+
<div class="discussion">
|
322
|
+
<p class="note private">
|
323
|
+
<strong>This method is part of a private API.</strong>
|
324
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
325
|
+
</p>
|
326
|
+
|
327
|
+
<p>(see Pattern#matches)</p>
|
328
|
+
|
329
|
+
|
330
|
+
</div>
|
331
|
+
</div>
|
332
|
+
<div class="tags">
|
333
|
+
|
334
|
+
<p class="tag_title">Returns:</p>
|
335
|
+
<ul class="return">
|
336
|
+
|
337
|
+
<li>
|
338
|
+
|
339
|
+
|
340
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
</li>
|
345
|
+
|
346
|
+
</ul>
|
347
|
+
|
348
|
+
</div><table class="source_code">
|
349
|
+
<tr>
|
350
|
+
<td>
|
351
|
+
<pre class="lines">
|
352
|
+
|
353
|
+
|
354
|
+
65
|
355
|
+
66
|
356
|
+
67
|
357
|
+
68
|
358
|
+
69
|
359
|
+
70
|
360
|
+
71
|
361
|
+
72
|
362
|
+
73
|
363
|
+
74
|
364
|
+
75</pre>
|
365
|
+
</td>
|
366
|
+
<td>
|
367
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 65</span>
|
368
|
+
|
369
|
+
<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>
|
370
|
+
<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>
|
371
|
+
|
372
|
+
<span class='comment'># We could not find a regexp pattern - maybe it's a simple string or something else?
|
373
|
+
</span> <span class='kw'>return</span> <span class='kw'>false</span> <span class='kw'>unless</span> <span class='id identifier rubyid_comparator'>comparator</span>
|
374
|
+
|
375
|
+
<span class='comment'># No need for a regular expression if we have simple string inequality
|
376
|
+
</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'>'</span><span class='tstring_content'>!=</span><span class='tstring_end'>'</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>
|
377
|
+
|
378
|
+
<span class='const'><span class='object_link'><a href="Proc.html" title="CSVDecision::Matchers::Proc (class)">Proc</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Proc.html#initialize-instance_method" title="CSVDecision::Matchers::Proc#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='label'>type:</span> <span class='symbol'>:proc</span><span class='comma'>,</span> <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>
|
379
|
+
<span class='kw'>end</span></pre>
|
380
|
+
</td>
|
381
|
+
</tr>
|
382
|
+
</table>
|
383
|
+
</div>
|
384
|
+
|
385
|
+
</div>
|
386
|
+
|
387
|
+
<div id="instance_method_details" class="method_details_list">
|
388
|
+
<h2>Instance Method Details</h2>
|
389
|
+
|
390
|
+
|
391
|
+
<div class="method_details first">
|
392
|
+
<h3 class="signature first" id="matches?-instance_method">
|
393
|
+
|
394
|
+
#<strong>matches?</strong>(cell) ⇒ <tt>false</tt>, <tt>CSVDecision::Proc</tt>
|
395
|
+
|
396
|
+
|
397
|
+
|
398
|
+
|
399
|
+
|
400
|
+
</h3><div class="docstring">
|
401
|
+
<div class="discussion">
|
402
|
+
<p class="note private">
|
403
|
+
<strong>This method is part of a private API.</strong>
|
404
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
405
|
+
</p>
|
406
|
+
|
407
|
+
<p>Recognise a regular expression pattern - e.g., <tt>=~ on|off</tt> or <tt>!~ OPT.*</tt>.
|
408
|
+
If the option regexp_implicit: true has been set, then cells may omit the
|
409
|
+
<tt>=~</tt> comparator so long as they contain non-word characters typically used
|
410
|
+
in regular expressions such as <tt>*</tt> and <code>.</code>.</p>
|
411
|
+
|
412
|
+
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
<div class="tags">
|
416
|
+
<p class="tag_title">Parameters:</p>
|
417
|
+
<ul class="param">
|
418
|
+
|
419
|
+
<li>
|
420
|
+
|
421
|
+
<span class='name'>cell</span>
|
422
|
+
|
423
|
+
|
424
|
+
<span class='type'>(<tt>String</tt>)</span>
|
425
|
+
|
426
|
+
|
427
|
+
|
428
|
+
—
|
429
|
+
<div class='inline'>
|
430
|
+
<p>Data row cell.</p>
|
431
|
+
</div>
|
432
|
+
|
433
|
+
</li>
|
434
|
+
|
435
|
+
</ul>
|
436
|
+
|
437
|
+
<p class="tag_title">Returns:</p>
|
438
|
+
<ul class="return">
|
439
|
+
|
440
|
+
<li>
|
441
|
+
|
442
|
+
|
443
|
+
<span class='type'>(<tt>false</tt>, <tt>CSVDecision::Proc</tt>)</span>
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
—
|
448
|
+
<div class='inline'>
|
449
|
+
<p>Returns false if this cell is not a match; otherwise returns the
|
450
|
+
<code>CSVDecision::Proc</code> object indicating if this is a constant or
|
451
|
+
some type of function.</p>
|
452
|
+
</div>
|
453
|
+
|
454
|
+
</li>
|
455
|
+
|
456
|
+
</ul>
|
457
|
+
|
458
|
+
</div><table class="source_code">
|
459
|
+
<tr>
|
460
|
+
<td>
|
461
|
+
<pre class="lines">
|
462
|
+
|
463
|
+
|
464
|
+
89
|
465
|
+
90
|
466
|
+
91</pre>
|
467
|
+
</td>
|
468
|
+
<td>
|
469
|
+
<pre class="code"><span class="info file"># File 'lib/csv_decision/matchers/pattern.rb', line 89</span>
|
470
|
+
|
471
|
+
<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>
|
472
|
+
<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>
|
473
|
+
<span class='kw'>end</span></pre>
|
474
|
+
</td>
|
475
|
+
</tr>
|
476
|
+
</table>
|
477
|
+
</div>
|
478
|
+
|
479
|
+
</div>
|
480
|
+
|
481
|
+
</div>
|
482
|
+
|
483
|
+
<div id="footer">
|
484
|
+
Generated on Sun Feb 11 10:26:09 2018 by
|
485
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
486
|
+
0.9.12 (ruby-2.4.0).
|
487
|
+
</div>
|
488
|
+
|
489
|
+
</div>
|
490
|
+
</body>
|
491
|
+
</html>
|