servus 0.3.0 → 0.4.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.
Files changed (132) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/servus/event_handler/event_handler_generator.rb +1 -1
  3. data/lib/generators/servus/guard/guard_generator.rb +1 -1
  4. data/lib/generators/servus/guard/templates/guard.rb.erb +5 -3
  5. data/lib/generators/servus/service/service_generator.rb +1 -1
  6. data/lib/servus/base.rb +46 -3
  7. data/lib/servus/config.rb +71 -3
  8. data/lib/servus/events/bus.rb +29 -0
  9. data/lib/servus/events/emitter.rb +15 -0
  10. data/lib/servus/guard.rb +7 -6
  11. data/lib/servus/guards/falsey_guard.rb +3 -3
  12. data/lib/servus/guards/presence_guard.rb +4 -4
  13. data/lib/servus/guards/state_guard.rb +4 -5
  14. data/lib/servus/guards/truthy_guard.rb +3 -3
  15. data/lib/servus/helpers/controller_helpers.rb +40 -0
  16. data/lib/servus/support/errors.rb +16 -0
  17. data/lib/servus/support/lockdown.rb +94 -0
  18. data/lib/servus/support/logger.rb +16 -0
  19. data/lib/servus/support/validator.rb +65 -34
  20. data/lib/servus/testing/example_builders.rb +52 -0
  21. data/lib/servus/testing/matchers.rb +99 -0
  22. data/lib/servus/version.rb +1 -1
  23. data/lib/servus.rb +1 -0
  24. metadata +7 -111
  25. data/.claude/commands/check-docs.md +0 -1
  26. data/.claude/commands/consistency-check.md +0 -1
  27. data/.claude/commands/fine-tooth-comb.md +0 -1
  28. data/.claude/commands/red-green-refactor.md +0 -5
  29. data/.claude/settings.json +0 -24
  30. data/.rspec +0 -3
  31. data/.rubocop.yml +0 -27
  32. data/.yardopts +0 -6
  33. data/CHANGELOG.md +0 -169
  34. data/CLAUDE.md +0 -10
  35. data/IDEAS.md +0 -5
  36. data/LICENSE.txt +0 -21
  37. data/READme.md +0 -856
  38. data/Rakefile +0 -45
  39. data/docs/core/1_overview.md +0 -81
  40. data/docs/core/2_architecture.md +0 -120
  41. data/docs/core/3_service_objects.md +0 -154
  42. data/docs/features/1_schema_validation.md +0 -161
  43. data/docs/features/2_error_handling.md +0 -129
  44. data/docs/features/3_async_execution.md +0 -81
  45. data/docs/features/4_logging.md +0 -64
  46. data/docs/features/5_event_bus.md +0 -244
  47. data/docs/features/6_guards.md +0 -356
  48. data/docs/features/7_lazy_resolvers.md +0 -238
  49. data/docs/features/guards_naming_convention.md +0 -540
  50. data/docs/guides/1_common_patterns.md +0 -90
  51. data/docs/guides/2_migration_guide.md +0 -225
  52. data/docs/integration/1_configuration.md +0 -154
  53. data/docs/integration/2_testing.md +0 -304
  54. data/docs/integration/3_rails_integration.md +0 -99
  55. data/docs/yard/Servus/Base.html +0 -1645
  56. data/docs/yard/Servus/Config.html +0 -582
  57. data/docs/yard/Servus/Extensions/Async/Call.html +0 -400
  58. data/docs/yard/Servus/Extensions/Async/Errors/AsyncError.html +0 -140
  59. data/docs/yard/Servus/Extensions/Async/Errors/JobEnqueueError.html +0 -154
  60. data/docs/yard/Servus/Extensions/Async/Errors/ServiceNotFoundError.html +0 -154
  61. data/docs/yard/Servus/Extensions/Async/Errors.html +0 -128
  62. data/docs/yard/Servus/Extensions/Async/Ext.html +0 -119
  63. data/docs/yard/Servus/Extensions/Async/Job.html +0 -310
  64. data/docs/yard/Servus/Extensions/Async.html +0 -141
  65. data/docs/yard/Servus/Extensions.html +0 -117
  66. data/docs/yard/Servus/Generators/ServiceGenerator.html +0 -261
  67. data/docs/yard/Servus/Generators.html +0 -115
  68. data/docs/yard/Servus/Helpers/ControllerHelpers.html +0 -457
  69. data/docs/yard/Servus/Helpers.html +0 -115
  70. data/docs/yard/Servus/Railtie.html +0 -134
  71. data/docs/yard/Servus/Support/Errors/AuthenticationError.html +0 -287
  72. data/docs/yard/Servus/Support/Errors/BadRequestError.html +0 -283
  73. data/docs/yard/Servus/Support/Errors/ForbiddenError.html +0 -284
  74. data/docs/yard/Servus/Support/Errors/InternalServerError.html +0 -283
  75. data/docs/yard/Servus/Support/Errors/NotFoundError.html +0 -284
  76. data/docs/yard/Servus/Support/Errors/ServiceError.html +0 -489
  77. data/docs/yard/Servus/Support/Errors/ServiceUnavailableError.html +0 -290
  78. data/docs/yard/Servus/Support/Errors/UnauthorizedError.html +0 -200
  79. data/docs/yard/Servus/Support/Errors/UnprocessableEntityError.html +0 -288
  80. data/docs/yard/Servus/Support/Errors/ValidationError.html +0 -200
  81. data/docs/yard/Servus/Support/Errors.html +0 -140
  82. data/docs/yard/Servus/Support/Logger.html +0 -856
  83. data/docs/yard/Servus/Support/Rescuer/BlockContext.html +0 -585
  84. data/docs/yard/Servus/Support/Rescuer/CallOverride.html +0 -257
  85. data/docs/yard/Servus/Support/Rescuer/ClassMethods.html +0 -343
  86. data/docs/yard/Servus/Support/Rescuer.html +0 -267
  87. data/docs/yard/Servus/Support/Response.html +0 -574
  88. data/docs/yard/Servus/Support/Validator.html +0 -1150
  89. data/docs/yard/Servus/Support.html +0 -119
  90. data/docs/yard/Servus/Testing/ExampleBuilders.html +0 -523
  91. data/docs/yard/Servus/Testing/ExampleExtractor.html +0 -578
  92. data/docs/yard/Servus/Testing.html +0 -142
  93. data/docs/yard/Servus.html +0 -343
  94. data/docs/yard/_index.html +0 -535
  95. data/docs/yard/class_list.html +0 -54
  96. data/docs/yard/css/common.css +0 -1
  97. data/docs/yard/css/full_list.css +0 -58
  98. data/docs/yard/css/style.css +0 -503
  99. data/docs/yard/file.1_common_patterns.html +0 -154
  100. data/docs/yard/file.1_configuration.html +0 -115
  101. data/docs/yard/file.1_overview.html +0 -142
  102. data/docs/yard/file.1_schema_validation.html +0 -188
  103. data/docs/yard/file.2_architecture.html +0 -157
  104. data/docs/yard/file.2_error_handling.html +0 -190
  105. data/docs/yard/file.2_migration_guide.html +0 -242
  106. data/docs/yard/file.2_testing.html +0 -227
  107. data/docs/yard/file.3_async_execution.html +0 -145
  108. data/docs/yard/file.3_rails_integration.html +0 -160
  109. data/docs/yard/file.3_service_objects.html +0 -191
  110. data/docs/yard/file.4_logging.html +0 -135
  111. data/docs/yard/file.ErrorHandling.html +0 -190
  112. data/docs/yard/file.READme.html +0 -674
  113. data/docs/yard/file.architecture.html +0 -157
  114. data/docs/yard/file.async_execution.html +0 -145
  115. data/docs/yard/file.common_patterns.html +0 -154
  116. data/docs/yard/file.configuration.html +0 -115
  117. data/docs/yard/file.error_handling.html +0 -190
  118. data/docs/yard/file.logging.html +0 -135
  119. data/docs/yard/file.migration_guide.html +0 -242
  120. data/docs/yard/file.overview.html +0 -142
  121. data/docs/yard/file.rails_integration.html +0 -160
  122. data/docs/yard/file.schema_validation.html +0 -188
  123. data/docs/yard/file.service_objects.html +0 -191
  124. data/docs/yard/file.testing.html +0 -227
  125. data/docs/yard/file_list.html +0 -119
  126. data/docs/yard/frames.html +0 -22
  127. data/docs/yard/index.html +0 -674
  128. data/docs/yard/js/app.js +0 -344
  129. data/docs/yard/js/full_list.js +0 -242
  130. data/docs/yard/js/jquery.js +0 -4
  131. data/docs/yard/method_list.html +0 -542
  132. data/docs/yard/top-level-namespace.html +0 -110
@@ -1,585 +0,0 @@
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: Servus::Support::Rescuer::BlockContext
8
-
9
- &mdash; Servus | Service Object Framework
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../../../css/style.css" type="text/css" />
14
-
15
- <link rel="stylesheet" href="../../../css/common.css" type="text/css" />
16
-
17
- <script type="text/javascript">
18
- pathId = "Servus::Support::Rescuer::BlockContext";
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 (B)</a> &raquo;
40
- <span class='title'><span class='object_link'><a href="../../../Servus.html" title="Servus (module)">Servus</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../../Support.html" title="Servus::Support (module)">Support</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Rescuer.html" title="Servus::Support::Rescuer (module)">Rescuer</a></span></span>
41
- &raquo;
42
- <span class="title">BlockContext</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: Servus::Support::Rescuer::BlockContext
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">Object</span>
73
-
74
- <ul class="fullTree">
75
- <li>Object</li>
76
-
77
- <li class="next">Servus::Support::Rescuer::BlockContext</li>
78
-
79
- </ul>
80
- <a href="#" class="inheritanceTree">show all</a>
81
-
82
- </dd>
83
- </dl>
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
- <dl>
96
- <dt>Defined in:</dt>
97
- <dd>lib/servus/support/rescuer.rb</dd>
98
- </dl>
99
-
100
- </div>
101
-
102
- <h2>Overview</h2><div class="docstring">
103
- <div class="discussion">
104
- <p class="note private">
105
- <strong>This class is part of a private API.</strong>
106
- You should avoid using this class if possible, as it may be removed or be changed in the future.
107
- </p>
108
- <p>Provides success/failure methods to rescue_from blocks.</p>
109
-
110
- <p>This context is used when a rescue_from block is executed. It provides
111
- the same success() and failure() methods available in service call methods,
112
- allowing blocks to create appropriate Response objects.</p>
113
-
114
-
115
- </div>
116
- </div>
117
- <div class="tags">
118
-
119
-
120
- </div>
121
-
122
-
123
-
124
- <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
125
- <ul class="summary">
126
-
127
- <li class="public ">
128
- <span class="summary_signature">
129
-
130
- <a href="#result-instance_method" title="#result (instance method)">#<strong>result</strong> &#x21d2; Servus::Support::Response<sup>?</sup> </a>
131
-
132
-
133
-
134
- </span>
135
-
136
-
137
-
138
-
139
- <span class="note title readonly">readonly</span>
140
-
141
-
142
-
143
-
144
-
145
-
146
- <span class="private note title">private</span>
147
-
148
-
149
- <span class="summary_desc"><div class='inline'><p>The response created by success() or failure().</p>
150
- </div></span>
151
-
152
- </li>
153
-
154
-
155
- </ul>
156
-
157
-
158
-
159
-
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="#failure-instance_method" title="#failure (instance method)">#<strong>failure</strong>(message = nil, type: Servus::Support::Errors::ServiceError) &#x21d2; Servus::Support::Response </a>
172
-
173
-
174
-
175
- </span>
176
-
177
-
178
-
179
-
180
-
181
-
182
- <span class="private note title">private</span>
183
-
184
-
185
- <span class="summary_desc"><div class='inline'><p>Creates a failure response.</p>
186
- </div></span>
187
-
188
- </li>
189
-
190
-
191
- <li class="public ">
192
- <span class="summary_signature">
193
-
194
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; BlockContext </a>
195
-
196
-
197
-
198
- </span>
199
-
200
-
201
- <span class="note title constructor">constructor</span>
202
-
203
-
204
-
205
-
206
-
207
- <span class="private note title">private</span>
208
-
209
-
210
- <span class="summary_desc"><div class='inline'><p>A new instance of BlockContext.</p>
211
- </div></span>
212
-
213
- </li>
214
-
215
-
216
- <li class="public ">
217
- <span class="summary_signature">
218
-
219
- <a href="#success-instance_method" title="#success (instance method)">#<strong>success</strong>(data = nil) &#x21d2; Servus::Support::Response </a>
220
-
221
-
222
-
223
- </span>
224
-
225
-
226
-
227
-
228
-
229
-
230
- <span class="private note title">private</span>
231
-
232
-
233
- <span class="summary_desc"><div class='inline'><p>Creates a success response.</p>
234
- </div></span>
235
-
236
- </li>
237
-
238
-
239
- </ul>
240
-
241
-
242
- <div id="constructor_details" class="method_details_list">
243
- <h2>Constructor Details</h2>
244
-
245
- <div class="method_details first">
246
- <h3 class="signature first" id="initialize-instance_method">
247
-
248
- #<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Servus::Support::Rescuer::BlockContext (class)">BlockContext</a></span></tt>
249
-
250
-
251
-
252
-
253
-
254
- </h3><div class="docstring">
255
- <div class="discussion">
256
- <p class="note private">
257
- <strong>This method is part of a private API.</strong>
258
- You should avoid using this method if possible, as it may be removed or be changed in the future.
259
- </p>
260
- <p>Returns a new instance of BlockContext.</p>
261
-
262
-
263
- </div>
264
- </div>
265
- <div class="tags">
266
-
267
-
268
- </div><table class="source_code">
269
- <tr>
270
- <td>
271
- <pre class="lines">
272
-
273
-
274
- 40
275
- 41
276
- 42</pre>
277
- </td>
278
- <td>
279
- <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 40</span>
280
-
281
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
282
- <span class='ivar'>@result</span> <span class='op'>=</span> <span class='kw'>nil</span>
283
- <span class='kw'>end</span></pre>
284
- </td>
285
- </tr>
286
- </table>
287
- </div>
288
-
289
- </div>
290
-
291
- <div id="instance_attr_details" class="attr_details">
292
- <h2>Instance Attribute Details</h2>
293
-
294
-
295
- <span id=""></span>
296
- <div class="method_details first">
297
- <h3 class="signature first" id="result-instance_method">
298
-
299
- #<strong>result</strong> &#x21d2; <tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt><sup>?</sup> <span class="extras">(readonly)</span>
300
-
301
-
302
-
303
-
304
-
305
- </h3><div class="docstring">
306
- <div class="discussion">
307
- <p class="note private">
308
- <strong>This method is part of a private API.</strong>
309
- You should avoid using this method if possible, as it may be removed or be changed in the future.
310
- </p>
311
- <p>The response created by success() or failure().</p>
312
-
313
-
314
- </div>
315
- </div>
316
- <div class="tags">
317
-
318
- <p class="tag_title">Returns:</p>
319
- <ul class="return">
320
-
321
- <li>
322
-
323
-
324
- <span class='type'>(<tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>, <tt>nil</tt>)</span>
325
-
326
-
327
-
328
- &mdash;
329
- <div class='inline'><p>The response, or nil if neither method was called</p>
330
- </div>
331
-
332
- </li>
333
-
334
- </ul>
335
-
336
- </div><table class="source_code">
337
- <tr>
338
- <td>
339
- <pre class="lines">
340
-
341
-
342
- 82
343
- 83
344
- 84</pre>
345
- </td>
346
- <td>
347
- <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 82</span>
348
-
349
- <span class='kw'>def</span> <span class='id identifier rubyid_result'>result</span>
350
- <span class='ivar'>@result</span>
351
- <span class='kw'>end</span></pre>
352
- </td>
353
- </tr>
354
- </table>
355
- </div>
356
-
357
- </div>
358
-
359
-
360
- <div id="instance_method_details" class="method_details_list">
361
- <h2>Instance Method Details</h2>
362
-
363
-
364
- <div class="method_details first">
365
- <h3 class="signature first" id="failure-instance_method">
366
-
367
- #<strong>failure</strong>(message = nil, type: Servus::Support::Errors::ServiceError) &#x21d2; <tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>
368
-
369
-
370
-
371
-
372
-
373
- </h3><div class="docstring">
374
- <div class="discussion">
375
- <p class="note private">
376
- <strong>This method is part of a private API.</strong>
377
- You should avoid using this method if possible, as it may be removed or be changed in the future.
378
- </p>
379
- <p>Creates a failure response.</p>
380
-
381
- <p>Use this in rescue_from blocks to convert exceptions into business failures
382
- with custom messages and error types.</p>
383
-
384
-
385
- </div>
386
- </div>
387
- <div class="tags">
388
-
389
- <div class="examples">
390
- <h4 class="tag_title">Examples:</h4>
391
-
392
-
393
- <pre class="example code"><code><span class='id identifier rubyid_rescue_from'>rescue_from</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>RecordInvalid</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_exception'>exception</span><span class='op'>|</span>
394
- <span class='id identifier rubyid_failure'>failure</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Database error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='embexpr_end'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='label'>type:</span> <span class='const'>InternalServerError</span><span class='rparen'>)</span>
395
- <span class='kw'>end</span></code></pre>
396
-
397
- </div>
398
- <p class="tag_title">Parameters:</p>
399
- <ul class="param">
400
-
401
- <li>
402
-
403
- <span class='name'>message</span>
404
-
405
-
406
- <span class='type'>(<tt>String</tt>, <tt>nil</tt>)</span>
407
-
408
-
409
- <em class="default">(defaults to: <tt>nil</tt>)</em>
410
-
411
-
412
- &mdash;
413
- <div class='inline'><p>The error message (uses error type&#39;s DEFAULT_MESSAGE if nil)</p>
414
- </div>
415
-
416
- </li>
417
-
418
- <li>
419
-
420
- <span class='name'>type</span>
421
-
422
-
423
- <span class='type'>(<tt>Class&lt;<span class='object_link'><a href="../Errors/ServiceError.html" title="Servus::Support::Errors::ServiceError (class)">Servus::Support::Errors::ServiceError</a></span>&gt;</tt>)</span>
424
-
425
-
426
- <em class="default">(defaults to: <tt>Servus::Support::Errors::ServiceError</tt>)</em>
427
-
428
-
429
- &mdash;
430
- <div class='inline'><p>The error type</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><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>)</span>
444
-
445
-
446
-
447
- &mdash;
448
- <div class='inline'><p>Failure response</p>
449
- </div>
450
-
451
- </li>
452
-
453
- </ul>
454
-
455
- </div><table class="source_code">
456
- <tr>
457
- <td>
458
- <pre class="lines">
459
-
460
-
461
- 73
462
- 74
463
- 75
464
- 76</pre>
465
- </td>
466
- <td>
467
- <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 73</span>
468
-
469
- <span class='kw'>def</span> <span class='id identifier rubyid_failure'>failure</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>type:</span> <span class='const'><span class='object_link'><a href="../../../Servus.html" title="Servus (module)">Servus</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../../Support.html" title="Servus::Support (module)">Support</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors.html" title="Servus::Support::Errors (module)">Errors</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors/ServiceError.html" title="Servus::Support::Errors::ServiceError (class)">ServiceError</a></span></span><span class='rparen'>)</span>
470
- <span class='id identifier rubyid_error'>error</span> <span class='op'>=</span> <span class='id identifier rubyid_type'>type</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
471
- <span class='ivar'>@result</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Response</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Response.html#initialize-instance_method" title="Servus::Support::Response#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>false</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_error'>error</span><span class='rparen'>)</span>
472
- <span class='kw'>end</span></pre>
473
- </td>
474
- </tr>
475
- </table>
476
- </div>
477
-
478
- <div class="method_details ">
479
- <h3 class="signature " id="success-instance_method">
480
-
481
- #<strong>success</strong>(data = nil) &#x21d2; <tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>
482
-
483
-
484
-
485
-
486
-
487
- </h3><div class="docstring">
488
- <div class="discussion">
489
- <p class="note private">
490
- <strong>This method is part of a private API.</strong>
491
- You should avoid using this method if possible, as it may be removed or be changed in the future.
492
- </p>
493
- <p>Creates a success response.</p>
494
-
495
- <p>Use this in rescue_from blocks to recover from exceptions and return
496
- successful results despite the error being raised.</p>
497
-
498
-
499
- </div>
500
- </div>
501
- <div class="tags">
502
-
503
- <div class="examples">
504
- <h4 class="tag_title">Examples:</h4>
505
-
506
-
507
- <pre class="example code"><code><span class='id identifier rubyid_rescue_from'>rescue_from</span> <span class='const'>SomeError</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_exception'>exception</span><span class='op'>|</span>
508
- <span class='id identifier rubyid_success'>success</span><span class='lparen'>(</span><span class='label'>recovered:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>original_error:</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span>
509
- <span class='kw'>end</span></code></pre>
510
-
511
- </div>
512
- <p class="tag_title">Parameters:</p>
513
- <ul class="param">
514
-
515
- <li>
516
-
517
- <span class='name'>data</span>
518
-
519
-
520
- <span class='type'>(<tt>Hash</tt>, <tt>Object</tt>)</span>
521
-
522
-
523
- <em class="default">(defaults to: <tt>nil</tt>)</em>
524
-
525
-
526
- &mdash;
527
- <div class='inline'><p>The success data to return</p>
528
- </div>
529
-
530
- </li>
531
-
532
- </ul>
533
-
534
- <p class="tag_title">Returns:</p>
535
- <ul class="return">
536
-
537
- <li>
538
-
539
-
540
- <span class='type'>(<tt><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Servus::Support::Response</a></span></tt>)</span>
541
-
542
-
543
-
544
- &mdash;
545
- <div class='inline'><p>Success response</p>
546
- </div>
547
-
548
- </li>
549
-
550
- </ul>
551
-
552
- </div><table class="source_code">
553
- <tr>
554
- <td>
555
- <pre class="lines">
556
-
557
-
558
- 56
559
- 57
560
- 58</pre>
561
- </td>
562
- <td>
563
- <pre class="code"><span class="info file"># File 'lib/servus/support/rescuer.rb', line 56</span>
564
-
565
- <span class='kw'>def</span> <span class='id identifier rubyid_success'>success</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
566
- <span class='ivar'>@result</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Response.html" title="Servus::Support::Response (class)">Response</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="../Response.html#initialize-instance_method" title="Servus::Support::Response#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>true</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
567
- <span class='kw'>end</span></pre>
568
- </td>
569
- </tr>
570
- </table>
571
- </div>
572
-
573
- </div>
574
-
575
- </div>
576
-
577
- <div id="footer">
578
- Generated on Fri Nov 21 00:33:24 2025 by
579
- <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
580
- 0.9.37 (ruby-3.4.4).
581
- </div>
582
-
583
- </div>
584
- </body>
585
- </html>