stub_requests 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -2
  3. data/.reek.yml +1 -0
  4. data/.rubocop.yml +33 -35
  5. data/.simplecov +14 -8
  6. data/.yardopts +1 -1
  7. data/CHANGELOG.md +4 -1
  8. data/README.md +19 -11
  9. data/Rakefile +1 -3
  10. data/bin/update_docs.sh +16 -0
  11. data/gemfiles/webmock_2.3.gemfile.lock +1 -1
  12. data/gemfiles/webmock_3.5.gemfile.lock +1 -1
  13. data/gemfiles/webmock_develop.gemfile.lock +1 -1
  14. data/lib/rspec/subject_as_lambda.rb +138 -0
  15. data/lib/stub_requests/api.rb +42 -8
  16. data/lib/stub_requests/argument_validation.rb +17 -6
  17. data/lib/stub_requests/configuration.rb +21 -0
  18. data/lib/stub_requests/core_ext/all.rb +4 -0
  19. data/lib/stub_requests/core_ext/array/extract_options.rb +32 -0
  20. data/lib/stub_requests/core_ext/class/attribute.rb +61 -0
  21. data/lib/stub_requests/core_ext/kernel/singleton_class.rb +12 -0
  22. data/lib/stub_requests/core_ext/module/redefine_method.rb +44 -0
  23. data/lib/stub_requests/core_ext/object/blank.rb +99 -155
  24. data/lib/stub_requests/endpoint.rb +28 -30
  25. data/lib/stub_requests/endpoint_registry.rb +18 -16
  26. data/lib/stub_requests/exceptions.rb +84 -0
  27. data/lib/stub_requests/hash_util.rb +2 -0
  28. data/lib/stub_requests/metrics/endpoint_stat.rb +97 -0
  29. data/lib/stub_requests/metrics/registry.rb +132 -0
  30. data/lib/stub_requests/metrics/stub_stat.rb +80 -0
  31. data/lib/stub_requests/metrics.rb +32 -0
  32. data/lib/stub_requests/property/validator.rb +136 -0
  33. data/lib/stub_requests/property.rb +99 -0
  34. data/lib/stub_requests/service.rb +12 -53
  35. data/lib/stub_requests/service_registry.rb +8 -9
  36. data/lib/stub_requests/stub_requests.rb +23 -51
  37. data/lib/stub_requests/uri/builder.rb +5 -1
  38. data/lib/stub_requests/uri/scheme.rb +3 -1
  39. data/lib/stub_requests/uri/suffix.rb +5 -0
  40. data/lib/stub_requests/uri/validator.rb +3 -1
  41. data/lib/stub_requests/uri.rb +34 -0
  42. data/lib/stub_requests/version.rb +1 -1
  43. data/lib/stub_requests/webmock/builder.rb +116 -0
  44. data/lib/stub_requests/webmock/stub_registry_extension.rb +46 -0
  45. data/lib/stub_requests.rb +21 -3
  46. metadata +19 -49
  47. data/docs/.gitkeep +0 -0
  48. data/docs/Array.html +0 -137
  49. data/docs/FalseClass.html +0 -232
  50. data/docs/Hash.html +0 -137
  51. data/docs/NilClass.html +0 -232
  52. data/docs/Numeric.html +0 -233
  53. data/docs/Object.html +0 -396
  54. data/docs/String.html +0 -298
  55. data/docs/StubRequests/API.html +0 -651
  56. data/docs/StubRequests/ArgumentValidation.html +0 -309
  57. data/docs/StubRequests/Endpoint.html +0 -1187
  58. data/docs/StubRequests/EndpointNotFound.html +0 -157
  59. data/docs/StubRequests/EndpointRegistry.html +0 -1527
  60. data/docs/StubRequests/Error.html +0 -153
  61. data/docs/StubRequests/HashUtil.html +0 -304
  62. data/docs/StubRequests/InvalidType.html +0 -252
  63. data/docs/StubRequests/InvalidUri.html +0 -252
  64. data/docs/StubRequests/Service.html +0 -1307
  65. data/docs/StubRequests/ServiceHaveEndpoints.html +0 -244
  66. data/docs/StubRequests/ServiceNotFound.html +0 -252
  67. data/docs/StubRequests/ServiceRegistry.html +0 -1031
  68. data/docs/StubRequests/URI/Builder.html +0 -1194
  69. data/docs/StubRequests/URI/Scheme.html +0 -315
  70. data/docs/StubRequests/URI/Suffix.html +0 -315
  71. data/docs/StubRequests/URI/Validator.html +0 -770
  72. data/docs/StubRequests/URI.html +0 -144
  73. data/docs/StubRequests/UriSegmentMismatch.html +0 -157
  74. data/docs/StubRequests/WebMockBuilder.html +0 -887
  75. data/docs/StubRequests.html +0 -452
  76. data/docs/Time.html +0 -232
  77. data/docs/TrueClass.html +0 -232
  78. data/docs/_config.yml +0 -1
  79. data/docs/_index.html +0 -391
  80. data/docs/class_list.html +0 -51
  81. data/docs/css/common.css +0 -1
  82. data/docs/css/full_list.css +0 -58
  83. data/docs/css/style.css +0 -496
  84. data/docs/file.README.html +0 -225
  85. data/docs/file_list.html +0 -56
  86. data/docs/frames.html +0 -17
  87. data/docs/index.html +0 -225
  88. data/docs/js/app.js +0 -292
  89. data/docs/js/full_list.js +0 -216
  90. data/docs/js/jquery.js +0 -4
  91. data/docs/method_list.html +0 -707
  92. data/docs/top-level-namespace.html +0 -112
  93. data/lib/stub_requests/webmock_builder.rb +0 -108
data/docs/Object.html DELETED
@@ -1,396 +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: Object
8
-
9
- &mdash; Documentation by YARD 0.9.18
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 = "Object";
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 (O)</a> &raquo;
40
-
41
-
42
- <span class="title">Object</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: Object
63
-
64
-
65
-
66
- </h1>
67
- <div class="box_info">
68
-
69
- <dl>
70
- <dt>Inherits:</dt>
71
- <dd>
72
- <span class="inheritName">BasicObject</span>
73
-
74
- </dd>
75
- </dl>
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
- <dl>
88
- <dt>Defined in:</dt>
89
- <dd>lib/stub_requests/core_ext/object/blank.rb</dd>
90
- </dl>
91
-
92
- </div>
93
-
94
- <h2>Overview</h2><div class="docstring">
95
- <div class="discussion">
96
-
97
-
98
- </div>
99
- </div>
100
- <div class="tags">
101
-
102
-
103
- <p class="tag_title">See Also:</p>
104
- <ul class="see">
105
-
106
- <li><span class='object_link'><a href="" title="Object (class)">Object</a></span></li>
107
-
108
- </ul>
109
-
110
- </div>
111
-
112
-
113
-
114
-
115
-
116
-
117
-
118
- <h2>
119
- Instance Method Summary
120
- <small><a href="#" class="summary_toggle">collapse</a></small>
121
- </h2>
122
-
123
- <ul class="summary">
124
-
125
- <li class="public ">
126
- <span class="summary_signature">
127
-
128
- <a href="#blank%3F-instance_method" title="#blank? (instance method)">#<strong>blank?</strong> &#x21d2; true, false </a>
129
-
130
-
131
-
132
- </span>
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
- <span class="summary_desc"><div class='inline'><p>An object is blank if it&#39;s false, empty, or a whitespace string.</p>
143
- </div></span>
144
-
145
- </li>
146
-
147
-
148
- <li class="public ">
149
- <span class="summary_signature">
150
-
151
- <a href="#presence-instance_method" title="#presence (instance method)">#<strong>presence</strong> &#x21d2; Object </a>
152
-
153
-
154
-
155
- </span>
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
- <span class="summary_desc"><div class='inline'><p>Returns the receiver if it&#39;s present otherwise returns +nil+.</p>
166
- </div></span>
167
-
168
- </li>
169
-
170
-
171
- <li class="public ">
172
- <span class="summary_signature">
173
-
174
- <a href="#present%3F-instance_method" title="#present? (instance method)">#<strong>present?</strong> &#x21d2; true, false </a>
175
-
176
-
177
-
178
- </span>
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
- <span class="summary_desc"><div class='inline'><p>An object is present if it&#39;s not blank.</p>
189
- </div></span>
190
-
191
- </li>
192
-
193
-
194
- </ul>
195
-
196
-
197
-
198
-
199
- <div id="instance_method_details" class="method_details_list">
200
- <h2>Instance Method Details</h2>
201
-
202
-
203
- <div class="method_details first">
204
- <h3 class="signature first" id="blank?-instance_method">
205
-
206
- #<strong>blank?</strong> &#x21d2; <tt>true</tt>, <tt>false</tt>
207
-
208
-
209
-
210
-
211
-
212
- </h3><div class="docstring">
213
- <div class="discussion">
214
- <p>An object is blank if it&#39;s false, empty, or a whitespace string.
215
- For example, +nil+, &#39;&#39;, &#39; &#39;, [], {}, and +false+ are all blank.</p>
216
-
217
- <p>This simplifies</p>
218
-
219
- <p>!address || address.empty?</p>
220
-
221
- <p>to</p>
222
-
223
- <p>address.blank?</p>
224
-
225
-
226
- </div>
227
- </div>
228
- <div class="tags">
229
-
230
- <p class="tag_title">Returns:</p>
231
- <ul class="return">
232
-
233
- <li>
234
-
235
-
236
- <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
237
-
238
-
239
-
240
- </li>
241
-
242
- </ul>
243
-
244
- </div><table class="source_code">
245
- <tr>
246
- <td>
247
- <pre class="lines">
248
-
249
-
250
- 24
251
- 25
252
- 26</pre>
253
- </td>
254
- <td>
255
- <pre class="code"><span class="info file"># File 'lib/stub_requests/core_ext/object/blank.rb', line 24</span>
256
-
257
- <span class='kw'>def</span> <span class='id identifier rubyid_blank?'>blank?</span>
258
- <span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:empty?</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='op'>!</span><span class='op'>!</span><span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>:</span> <span class='op'>!</span><span class='kw'>self</span> <span class='comment'># rubocop:disable Style/DoubleNegation
259
- </span><span class='kw'>end</span></pre>
260
- </td>
261
- </tr>
262
- </table>
263
- </div>
264
-
265
- <div class="method_details ">
266
- <h3 class="signature " id="presence-instance_method">
267
-
268
- #<strong>presence</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Object (class)">Object</a></span></tt>
269
-
270
-
271
-
272
-
273
-
274
- </h3><div class="docstring">
275
- <div class="discussion">
276
- <p>Returns the receiver if it&#39;s present otherwise returns +nil+.
277
- <tt>object.presence</tt> is equivalent to</p>
278
-
279
- <p>object.present? ? object : nil</p>
280
-
281
- <p>For example, something like</p>
282
-
283
- <p>state = params[:state] if params[:state].present?
284
- country = params[:country] if params[:country].present?
285
- region = state || country || &#39;US&#39;</p>
286
-
287
- <p>becomes</p>
288
-
289
- <p>region = params[:state].presence || params[:country].presence || &#39;US&#39;</p>
290
-
291
-
292
- </div>
293
- </div>
294
- <div class="tags">
295
-
296
- <p class="tag_title">Returns:</p>
297
- <ul class="return">
298
-
299
- <li>
300
-
301
-
302
- <span class='type'>(<tt><span class='object_link'><a href="" title="Object (class)">Object</a></span></tt>)</span>
303
-
304
-
305
-
306
- </li>
307
-
308
- </ul>
309
-
310
- </div><table class="source_code">
311
- <tr>
312
- <td>
313
- <pre class="lines">
314
-
315
-
316
- 51
317
- 52
318
- 53</pre>
319
- </td>
320
- <td>
321
- <pre class="code"><span class="info file"># File 'lib/stub_requests/core_ext/object/blank.rb', line 51</span>
322
-
323
- <span class='kw'>def</span> <span class='id identifier rubyid_presence'>presence</span>
324
- <span class='kw'>self</span> <span class='kw'>if</span> <span class='id identifier rubyid_present?'>present?</span>
325
- <span class='kw'>end</span></pre>
326
- </td>
327
- </tr>
328
- </table>
329
- </div>
330
-
331
- <div class="method_details ">
332
- <h3 class="signature " id="present?-instance_method">
333
-
334
- #<strong>present?</strong> &#x21d2; <tt>true</tt>, <tt>false</tt>
335
-
336
-
337
-
338
-
339
-
340
- </h3><div class="docstring">
341
- <div class="discussion">
342
- <p>An object is present if it&#39;s not blank.</p>
343
-
344
-
345
- </div>
346
- </div>
347
- <div class="tags">
348
-
349
- <p class="tag_title">Returns:</p>
350
- <ul class="return">
351
-
352
- <li>
353
-
354
-
355
- <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
356
-
357
-
358
-
359
- </li>
360
-
361
- </ul>
362
-
363
- </div><table class="source_code">
364
- <tr>
365
- <td>
366
- <pre class="lines">
367
-
368
-
369
- 31
370
- 32
371
- 33</pre>
372
- </td>
373
- <td>
374
- <pre class="code"><span class="info file"># File 'lib/stub_requests/core_ext/object/blank.rb', line 31</span>
375
-
376
- <span class='kw'>def</span> <span class='id identifier rubyid_present?'>present?</span>
377
- <span class='op'>!</span><span class='id identifier rubyid_blank?'>blank?</span>
378
- <span class='kw'>end</span></pre>
379
- </td>
380
- </tr>
381
- </table>
382
- </div>
383
-
384
- </div>
385
-
386
- </div>
387
-
388
- <div id="footer">
389
- Generated on Fri Feb 1 19:57:30 2019 by
390
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
391
- 0.9.18 (ruby-2.5.3).
392
- </div>
393
-
394
- </div>
395
- </body>
396
- </html>
data/docs/String.html DELETED
@@ -1,298 +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: String
8
-
9
- &mdash; Documentation by YARD 0.9.18
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 = "String";
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 (S)</a> &raquo;
40
-
41
-
42
- <span class="title">String</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: String
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="Object.html" title="Object (class)">Object</a></span></span>
73
-
74
- <ul class="fullTree">
75
- <li><span class='object_link'><a href="Object.html" title="Object (class)">Object</a></span></li>
76
-
77
- <li class="next">String</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/stub_requests/core_ext/object/blank.rb</dd>
98
- </dl>
99
-
100
- </div>
101
-
102
- <h2>Overview</h2><div class="docstring">
103
- <div class="discussion">
104
-
105
-
106
- </div>
107
- </div>
108
- <div class="tags">
109
-
110
-
111
- <p class="tag_title">See Also:</p>
112
- <ul class="see">
113
-
114
- <li><span class='object_link'><a href="" title="String (class)">String</a></span></li>
115
-
116
- </ul>
117
-
118
- </div>
119
-
120
- <h2>
121
- Constant Summary
122
- <small><a href="#" class="constants_summary_toggle">collapse</a></small>
123
- </h2>
124
-
125
- <dl class="constants">
126
-
127
- <dt id="BLANK_RE-constant" class="">BLANK_RE =
128
- <div class="docstring">
129
- <div class="discussion">
130
- <p>:nodoc:</p>
131
-
132
-
133
- </div>
134
- </div>
135
- <div class="tags">
136
-
137
-
138
- </div>
139
- </dt>
140
- <dd><pre class="code"><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A[[:space:]]*\z</span><span class='regexp_end'>/</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
141
-
142
- <dt id="ENCODED_BLANKS-constant" class="">ENCODED_BLANKS =
143
- <div class="docstring">
144
- <div class="discussion">
145
- <p>:nodoc:</p>
146
-
147
-
148
- </div>
149
- </div>
150
- <div class="tags">
151
-
152
-
153
- </div>
154
- </dt>
155
- <dd><pre class="code"><span class='const'>Concurrent</span><span class='op'>::</span><span class='const'>Map</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_map'>map</span><span class='comma'>,</span> <span class='id identifier rubyid_enc'>enc</span><span class='op'>|</span>
156
- <span class='id identifier rubyid_map'>map</span><span class='lbracket'>[</span><span class='id identifier rubyid_enc'>enc</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Regexp</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="#BLANK_RE-constant" title="String::BLANK_RE (constant)">BLANK_RE</a></span></span><span class='period'>.</span><span class='id identifier rubyid_source'>source</span><span class='period'>.</span><span class='id identifier rubyid_encode'>encode</span><span class='lparen'>(</span><span class='id identifier rubyid_enc'>enc</span><span class='rparen'>)</span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#BLANK_RE-constant" title="String::BLANK_RE (constant)">BLANK_RE</a></span></span><span class='period'>.</span><span class='id identifier rubyid_options'>options</span> <span class='op'>|</span> <span class='const'>Regexp</span><span class='op'>::</span><span class='const'>FIXEDENCODING</span><span class='rparen'>)</span>
157
- <span class='kw'>end</span></pre></dd>
158
-
159
- </dl>
160
-
161
-
162
-
163
-
164
-
165
-
166
-
167
-
168
-
169
- <h2>
170
- Instance Method Summary
171
- <small><a href="#" class="summary_toggle">collapse</a></small>
172
- </h2>
173
-
174
- <ul class="summary">
175
-
176
- <li class="public ">
177
- <span class="summary_signature">
178
-
179
- <a href="#blank%3F-instance_method" title="#blank? (instance method)">#<strong>blank?</strong> &#x21d2; true, false </a>
180
-
181
-
182
-
183
- </span>
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
- <span class="summary_desc"><div class='inline'><p>A string is blank if it&#39;s empty or contains whitespaces only:.</p>
194
- </div></span>
195
-
196
- </li>
197
-
198
-
199
- </ul>
200
-
201
-
202
-
203
-
204
- <div id="instance_method_details" class="method_details_list">
205
- <h2>Instance Method Details</h2>
206
-
207
-
208
- <div class="method_details first">
209
- <h3 class="signature first" id="blank?-instance_method">
210
-
211
- #<strong>blank?</strong> &#x21d2; <tt>true</tt>, <tt>false</tt>
212
-
213
-
214
-
215
-
216
-
217
- </h3><div class="docstring">
218
- <div class="discussion">
219
- <p>A string is blank if it&#39;s empty or contains whitespaces only:</p>
220
-
221
- <p>&#39;&#39;.blank? # =&gt; true
222
- &#39; &#39;.blank? # =&gt; true
223
- &quot;\t\n\r&quot;.blank? # =&gt; true
224
- &#39; blah &#39;.blank? # =&gt; false</p>
225
-
226
- <p>Unicode whitespace is supported:</p>
227
-
228
- <p>&quot;\u00a0&quot;.blank? # =&gt; true</p>
229
-
230
-
231
- </div>
232
- </div>
233
- <div class="tags">
234
-
235
- <p class="tag_title">Returns:</p>
236
- <ul class="return">
237
-
238
- <li>
239
-
240
-
241
- <span class='type'>(<tt>true</tt>, <tt>false</tt>)</span>
242
-
243
-
244
-
245
- </li>
246
-
247
- </ul>
248
-
249
- </div><table class="source_code">
250
- <tr>
251
- <td>
252
- <pre class="lines">
253
-
254
-
255
- 135
256
- 136
257
- 137
258
- 138
259
- 139
260
- 140
261
- 141
262
- 142
263
- 143
264
- 144
265
- 145</pre>
266
- </td>
267
- <td>
268
- <pre class="code"><span class="info file"># File 'lib/stub_requests/core_ext/object/blank.rb', line 135</span>
269
-
270
- <span class='kw'>def</span> <span class='id identifier rubyid_blank?'>blank?</span>
271
- <span class='comment'># The regexp that matches blank strings is expensive. For the case of empty
272
- </span> <span class='comment'># strings we can speed up this method (~3.5x) with an empty? call. The
273
- </span> <span class='comment'># penalty for the rest of strings is marginal.
274
- </span> <span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>||</span>
275
- <span class='kw'>begin</span>
276
- <span class='const'><span class='object_link'><a href="#BLANK_RE-constant" title="String::BLANK_RE (constant)">BLANK_RE</a></span></span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
277
- <span class='kw'>rescue</span> <span class='const'>Encoding</span><span class='op'>::</span><span class='const'>CompatibilityError</span>
278
- <span class='const'><span class='object_link'><a href="#ENCODED_BLANKS-constant" title="String::ENCODED_BLANKS (constant)">ENCODED_BLANKS</a></span></span><span class='lbracket'>[</span><span class='id identifier rubyid_encoding'>encoding</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_match?'>match?</span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span>
279
- <span class='kw'>end</span>
280
- <span class='kw'>end</span></pre>
281
- </td>
282
- </tr>
283
- </table>
284
- </div>
285
-
286
- </div>
287
-
288
- </div>
289
-
290
- <div id="footer">
291
- Generated on Fri Feb 1 19:57:30 2019 by
292
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
293
- 0.9.18 (ruby-2.5.3).
294
- </div>
295
-
296
- </div>
297
- </body>
298
- </html>