pwned 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 502db43dbcbc77b9ea32dbac1b642d4f682f3969b810b13c2ec02b381c1b50e9
4
- data.tar.gz: 5ef819185c54637d5544b7fd27134d1ae61c07ed2eaf464b7040e39fa8b15937
3
+ metadata.gz: 1e197213ac23ae94598dbf91b7a09fadd740db379d5abefdb8ad7c9623d9514b
4
+ data.tar.gz: 960c6e4ab1d856480dbc236059abea531dc747f4a1d59a7e7db52534c2958866
5
5
  SHA512:
6
- metadata.gz: fd00a0191f6d8a379ef7380cda0e7de42bdcc996483c45256185c535fb16d6a61b40a850d0f9383efda0e4441cde66ec5e24b73152a0e9af3d78da9b74a3a63f
7
- data.tar.gz: bf4299bd181ff6d7b37754ed3cfefd52f9ea5fb72f9219b48a403137d5950c530be60ec85f9dfe58f412d1dbcbdb7958e0e0dc062ff8006728aa5d454899c6ae
6
+ metadata.gz: dede2324974438b89612b443e50c8d7c06fe9b35d3e5c6f36661ad73d28513ebb62eedbc60f0a72d346c935141b96f30b98a6ad21cb2950f45a418c76d33c6b1
7
+ data.tar.gz: 32a0659ce0a7b80967ebf68809bf5881623f473ab561dfcba9f131eb86af60b9f0cb4031603c85c295d37f9d7aae10ce03ae3a580c3cc437c486cff099a4f962
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Ongoing [☰](https://github.com/philnash/pwned/compare/v1.1.0...master)
4
4
 
5
+ ...
6
+
7
+ ## 1.2.0 (March 15, 2018) [☰](https://github.com/philnash/pwned/commits/v1.2.0)
8
+
9
+ * Major updates
10
+ * Changes `PwnedValidator` to `NotPwnedValidator`, so that the validation looks like `validates :password, not_pwned: true`. `PwnedValidator` now subclasses `NotPwnedValidator` for backwards compatibility with version 1.1.0 but is deprecated.
11
+
5
12
  ## 1.1.0 (March 12, 2018) [☰](https://github.com/philnash/pwned/commits/v1.1.0)
6
13
 
7
14
  * Major updates
data/README.md CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  An easy, Ruby way to use the Pwned Passwords API.
4
4
 
5
- [![Build Status](https://travis-ci.org/philnash/pwned.svg?branch=master)](https://travis-ci.org/philnash/pwned)
5
+ [![Gem Version](https://badge.fury.io/rb/pwned.svg)](https://rubygems.org/gems/pwned) [![Build Status](https://travis-ci.org/philnash/pwned.svg?branch=master)](https://travis-ci.org/philnash/pwned) [![Maintainability](https://codeclimate.com/github/philnash/pwned/badges/gpa.svg)](https://codeclimate.com/github/philnash/pwned/maintainability)
6
+
7
+ [API docs](https://philnash.github.io/pwned/) | [GitHub repo](https://github.com/philnash/pwned)
8
+
9
+ ## About
6
10
 
7
11
  Troy Hunt's [Pwned Passwords API V2](https://haveibeenpwned.com/API/v2#PwnedPasswords) allows you to check if a password has been found in any of the huge data breaches.
8
12
 
@@ -80,9 +84,9 @@ There is a custom validator available for your ActiveRecord models:
80
84
 
81
85
  ```ruby
82
86
  class User < ApplicationRecord
83
- validates :password, pwned: true
87
+ validates :password, not_pwned: true
84
88
  # or
85
- validates :password, pwned: { message: "has been pwned %{count} times" }
89
+ validates :password, not_pwned: { message: "has been pwned %{count} times" }
86
90
  end
87
91
  ```
88
92
 
@@ -94,7 +98,7 @@ You can change the error message using I18n (use `%{count}` to interpolate the n
94
98
  en:
95
99
  errors:
96
100
  messages:
97
- pwned: has been pwned %{count} times
101
+ not_pwned: has been pwned %{count} times
98
102
  pwned_error: might be pwned
99
103
  ```
100
104
 
@@ -105,7 +109,7 @@ If you are ok with the password appearing a certain number of times before you d
105
109
  ```ruby
106
110
  class User < ApplicationRecord
107
111
  # The record is marked as valid if the password has been used once in the breached data
108
- validates :password, pwned: { threshold: 1 }
112
+ validates :password, not_pwned: { threshold: 1 }
109
113
  end
110
114
  ```
111
115
 
@@ -116,24 +120,24 @@ By default the record will be treated as valid when we cannot reach the [haveibe
116
120
  ```ruby
117
121
  class User < ApplicationRecord
118
122
  # The record is marked as valid on network errors.
119
- validates :password, pwned: true
120
- validates :password, pwned: { on_error: :valid }
123
+ validates :password, not_pwned: true
124
+ validates :password, not_pwned: { on_error: :valid }
121
125
 
122
126
  # The record is marked as invalid on network errors
123
127
  # (error message "could not be verified against the past data breaches".)
124
- validates :password, pwned: { on_error: :invalid }
128
+ validates :password, not_pwned: { on_error: :invalid }
125
129
 
126
130
  # The record is marked as invalid on network errors with custom error.
127
- validates :password, pwned: { on_error: :invalid, error_message: "might be pwned" }
131
+ validates :password, not_pwned: { on_error: :invalid, error_message: "might be pwned" }
128
132
 
129
133
  # We will raise an error on network errors.
130
134
  # This means that `record.valid?` will raise `Pwned::Error`.
131
135
  # Not recommended to use in production.
132
- validates :password, pwned: { on_error: :raise_error }
136
+ validates :password, not_pwned: { on_error: :raise_error }
133
137
 
134
138
  # Call custom proc on error. For example, capture errors in Sentry,
135
139
  # but do not mark the record as invalid.
136
- validates :password, pwned: {
140
+ validates :password, not_pwned: {
137
141
  on_error: ->(record, error) { Raven.capture_exception(error) }
138
142
  }
139
143
  end
@@ -144,7 +148,7 @@ end
144
148
  You can configure network requests made from the validator using `:request_options` (see [OpenURI::OpenRead#open](http://ruby-doc.org/stdlib-2.5.0/libdoc/open-uri/rdoc/OpenURI/OpenRead.html#method-i-open) for the list of available options, string keys represent custom network request headers, e.g. `"User-Agent"`):
145
149
 
146
150
  ```ruby
147
- validates :password, pwned: {
151
+ validates :password, not_pwned: {
148
152
  request_options: { read_timeout: 5, open_timeout: 1, "User-Agent" => "Super fun user agent" }
149
153
  }
150
154
  ```
data/Rakefile CHANGED
@@ -1,6 +1,11 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
+ require "yard"
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
7
  task :default => :spec
8
+
9
+ YARD::Rake::YardocTask.new do |t|
10
+ t.options = ["--output-dir", "docs"]
11
+ end
@@ -0,0 +1,425 @@
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: NotPwnedValidator
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 = "NotPwnedValidator";
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 (N)</a> &raquo;
40
+
41
+
42
+ <span class="title">NotPwnedValidator</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: NotPwnedValidator
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">ActiveModel::EachValidator</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">ActiveModel::EachValidator</li>
78
+
79
+ <li class="next">NotPwnedValidator</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/pwned/not_pwned_validator.rb</dd>
100
+ </dl>
101
+
102
+ </div>
103
+
104
+ <h2>Overview</h2><div class="docstring">
105
+ <div class="discussion">
106
+
107
+ <p>An <code>ActiveModel</code> validator to check passwords against the Pwned
108
+ Passwords API.</p>
109
+
110
+
111
+ </div>
112
+ </div>
113
+ <div class="tags">
114
+
115
+ <div class="examples">
116
+ <p class="tag_title">Examples:</p>
117
+
118
+
119
+ <p class="example_title"><div class='inline'>
120
+ <p>Validate a password on a <code>User</code> model with the default options.</p>
121
+ </div></p>
122
+
123
+ <pre class="example code"><code><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
124
+ <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='kw'>true</span>
125
+ <span class='kw'>end</span></code></pre>
126
+
127
+
128
+ <p class="example_title"><div class='inline'>
129
+ <p>Validate a password on a <code>User</code> model with a custom error
130
+ message.</p>
131
+ </div></p>
132
+
133
+ <pre class="example code"><code><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
134
+ <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>message:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>has been pwned %{count} times</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
135
+ <span class='kw'>end</span></code></pre>
136
+
137
+
138
+ <p class="example_title"><div class='inline'>
139
+ <p>Validate a password on a <code>User</code> model that allows the password
140
+ to have been breached once.</p>
141
+ </div></p>
142
+
143
+ <pre class="example code"><code><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
144
+ <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>threshold:</span> <span class='int'>1</span> <span class='rbrace'>}</span>
145
+ <span class='kw'>end</span></code></pre>
146
+
147
+
148
+ <p class="example_title"><div class='inline'>
149
+ <p>Validate a password on a <code>User</code> model, handling API errors in
150
+ various ways</p>
151
+ </div></p>
152
+
153
+ <pre class="example code"><code><span class='kw'>class</span> <span class='const'>User</span> <span class='op'>&lt;</span> <span class='const'>ApplicationRecord</span>
154
+ <span class='comment'># The record is marked as invalid on network errors
155
+ </span> <span class='comment'># (error message &quot;could not be verified against the past data breaches&quot;.)
156
+ </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>on_error:</span> <span class='symbol'>:invalid</span> <span class='rbrace'>}</span>
157
+
158
+ <span class='comment'># The record is marked as invalid on network errors with custom error.
159
+ </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>on_error:</span> <span class='symbol'>:invalid</span><span class='comma'>,</span> <span class='label'>error_message:</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>might be pwned</span><span class='tstring_end'>&quot;</span></span> <span class='rbrace'>}</span>
160
+
161
+ <span class='comment'># An error is raised on network errors.
162
+ </span> <span class='comment'># This means that `record.valid?` will raise `Pwned::Error`.
163
+ </span> <span class='comment'># Not recommended to use in production.
164
+ </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span> <span class='label'>on_error:</span> <span class='symbol'>:raise_error</span> <span class='rbrace'>}</span>
165
+
166
+ <span class='comment'># Call custom proc on error. For example, capture errors in Sentry,
167
+ </span> <span class='comment'># but do not mark the record as invalid.
168
+ </span> <span class='id identifier rubyid_validates'>validates</span> <span class='symbol'>:password</span><span class='comma'>,</span> <span class='label'>not_pwned:</span> <span class='lbrace'>{</span>
169
+ <span class='label'>on_error:</span> <span class='tlambda'>-&gt;</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span> <span class='tlambeg'>{</span> <span class='const'>Raven</span><span class='period'>.</span><span class='id identifier rubyid_capture_exception'>capture_exception</span><span class='lparen'>(</span><span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
170
+ <span class='rbrace'>}</span>
171
+ <span class='kw'>end</span></code></pre>
172
+
173
+ </div>
174
+
175
+ <p class="tag_title">Since:</p>
176
+ <ul class="since">
177
+
178
+ <li>
179
+
180
+
181
+
182
+
183
+
184
+ <div class='inline'>
185
+ <p>1.2.0</p>
186
+ </div>
187
+
188
+ </li>
189
+
190
+ </ul>
191
+
192
+ </div><div id="subclasses">
193
+ <h2>Direct Known Subclasses</h2>
194
+ <p class="children"><span class='object_link'><a href="PwnedValidator.html" title="PwnedValidator (class)">PwnedValidator</a></span></p>
195
+ </div>
196
+
197
+ <h2>Constant Summary</h2>
198
+ <dl class="constants">
199
+
200
+ <dt id="DEFAULT_ON_ERROR-constant" class="">DEFAULT_ON_ERROR =
201
+ <div class="docstring">
202
+ <div class="discussion">
203
+
204
+ <p>The default behaviour of this validator in the case of an API failure. The
205
+ default will mean that if the API fails the object will not be marked
206
+ invalid.</p>
207
+
208
+
209
+ </div>
210
+ </div>
211
+ <div class="tags">
212
+
213
+ <p class="tag_title">Since:</p>
214
+ <ul class="since">
215
+
216
+ <li>
217
+
218
+
219
+
220
+
221
+
222
+ <div class='inline'>
223
+ <p>1.2.0</p>
224
+ </div>
225
+
226
+ </li>
227
+
228
+ </ul>
229
+
230
+ </div>
231
+ </dt>
232
+ <dd><pre class="code"><span class='symbol'>:valid</span></pre></dd>
233
+
234
+ <dt id="DEFAULT_THRESHOLD-constant" class="">DEFAULT_THRESHOLD =
235
+ <div class="docstring">
236
+ <div class="discussion">
237
+
238
+ <p>The default threshold for whether a breach is considered pwned. The default
239
+ is 0, so any password that appears in a breach will mark the record as
240
+ invalid.</p>
241
+
242
+
243
+ </div>
244
+ </div>
245
+ <div class="tags">
246
+
247
+ <p class="tag_title">Since:</p>
248
+ <ul class="since">
249
+
250
+ <li>
251
+
252
+
253
+
254
+
255
+
256
+ <div class='inline'>
257
+ <p>1.2.0</p>
258
+ </div>
259
+
260
+ </li>
261
+
262
+ </ul>
263
+
264
+ </div>
265
+ </dt>
266
+ <dd><pre class="code"><span class='int'>0</span></pre></dd>
267
+
268
+ </dl>
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+ <h2>
278
+ Instance Method Summary
279
+ <small><a href="#" class="summary_toggle">collapse</a></small>
280
+ </h2>
281
+
282
+ <ul class="summary">
283
+
284
+ <li class="public ">
285
+ <span class="summary_signature">
286
+
287
+ <a href="#validate_each-instance_method" title="#validate_each (instance method)">#<strong>validate_each</strong>(record, attribute, value) &#x21d2; Object </a>
288
+
289
+
290
+
291
+ </span>
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+ <span class="summary_desc"><div class='inline'>
302
+ <p>Validates the <code>value</code> against the Pwned Passwords API.</p>
303
+ </div></span>
304
+
305
+ </li>
306
+
307
+
308
+ </ul>
309
+
310
+
311
+
312
+
313
+
314
+ <div id="instance_method_details" class="method_details_list">
315
+ <h2>Instance Method Details</h2>
316
+
317
+
318
+ <div class="method_details first">
319
+ <h3 class="signature first" id="validate_each-instance_method">
320
+
321
+ #<strong>validate_each</strong>(record, attribute, value) &#x21d2; <tt>Object</tt>
322
+
323
+
324
+
325
+
326
+
327
+ </h3><div class="docstring">
328
+ <div class="discussion">
329
+
330
+ <p>Validates the <code>value</code> against the Pwned Passwords API. If the
331
+ <code>pwned_count</code> is higher than the optional <code>threshold</code>
332
+ then the record is marked as invalid.</p>
333
+
334
+ <p>In the case of an API error the validator will either mark the record as
335
+ valid or invalid. Alternatively it will run an associated proc or re-raise
336
+ the original error.</p>
337
+
338
+
339
+ </div>
340
+ </div>
341
+ <div class="tags">
342
+
343
+ <p class="tag_title">Since:</p>
344
+ <ul class="since">
345
+
346
+ <li>
347
+
348
+
349
+
350
+
351
+
352
+ <div class='inline'>
353
+ <p>1.2.0</p>
354
+ </div>
355
+
356
+ </li>
357
+
358
+ </ul>
359
+
360
+ </div><table class="source_code">
361
+ <tr>
362
+ <td>
363
+ <pre class="lines">
364
+
365
+
366
+ 64
367
+ 65
368
+ 66
369
+ 67
370
+ 68
371
+ 69
372
+ 70
373
+ 71
374
+ 72
375
+ 73
376
+ 74
377
+ 75
378
+ 76
379
+ 77
380
+ 78
381
+ 79
382
+ 80
383
+ 81
384
+ 82</pre>
385
+ </td>
386
+ <td>
387
+ <pre class="code"><span class="info file"># File 'lib/pwned/not_pwned_validator.rb', line 64</span>
388
+
389
+ <span class='kw'>def</span> <span class='id identifier rubyid_validate_each'>validate_each</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
390
+ <span class='kw'>begin</span>
391
+ <span class='id identifier rubyid_pwned_check'>pwned_check</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Pwned/Password.html" title="Pwned::Password (class)">Password</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Pwned/Password.html#initialize-instance_method" title="Pwned::Password#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='comma'>,</span> <span class='id identifier rubyid_request_options'>request_options</span><span class='rparen'>)</span>
392
+ <span class='kw'>if</span> <span class='id identifier rubyid_pwned_check'>pwned_check</span><span class='period'>.</span><span class='id identifier rubyid_pwned_count'>pwned_count</span> <span class='op'>&gt;</span> <span class='id identifier rubyid_threshold'>threshold</span>
393
+ <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='symbol'>:not_pwned</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>count:</span> <span class='id identifier rubyid_pwned_check'>pwned_check</span><span class='period'>.</span><span class='id identifier rubyid_pwned_count'>pwned_count</span><span class='rparen'>)</span><span class='rparen'>)</span>
394
+ <span class='kw'>end</span>
395
+ <span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="Pwned.html" title="Pwned (module)">Pwned</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Pwned/Error.html" title="Pwned::Error (class)">Error</a></span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_error'>error</span>
396
+ <span class='kw'>case</span> <span class='id identifier rubyid_on_error'>on_error</span>
397
+ <span class='kw'>when</span> <span class='symbol'>:invalid</span>
398
+ <span class='id identifier rubyid_record'>record</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='symbol'>:pwned_error</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>message:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:error_message</span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='rparen'>)</span>
399
+ <span class='kw'>when</span> <span class='symbol'>:valid</span>
400
+ <span class='comment'># Do nothing, consider the record valid
401
+ </span> <span class='kw'>when</span> <span class='const'>Proc</span>
402
+ <span class='id identifier rubyid_on_error'>on_error</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_record'>record</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
403
+ <span class='kw'>else</span>
404
+ <span class='id identifier rubyid_raise'>raise</span>
405
+ <span class='kw'>end</span>
406
+ <span class='kw'>end</span>
407
+ <span class='kw'>end</span></pre>
408
+ </td>
409
+ </tr>
410
+ </table>
411
+ </div>
412
+
413
+ </div>
414
+
415
+ </div>
416
+
417
+ <div id="footer">
418
+ Generated on Wed Mar 14 11:06:58 2018 by
419
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
420
+ 0.9.12 (ruby-2.5.0).
421
+ </div>
422
+
423
+ </div>
424
+ </body>
425
+ </html>