stub_requests 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +7 -0
- data/.reek.yml +1 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +15 -0
- data/.yardopts +1 -1
- data/Appraisals +11 -0
- data/CHANGELOG.md +17 -0
- data/README.md +15 -2
- data/Rakefile +16 -1
- data/docs/.gitkeep +0 -0
- data/docs/Array.html +137 -0
- data/docs/FalseClass.html +232 -0
- data/docs/Hash.html +137 -0
- data/docs/NilClass.html +232 -0
- data/docs/Numeric.html +233 -0
- data/docs/Object.html +396 -0
- data/docs/String.html +298 -0
- data/docs/StubRequests/API.html +651 -0
- data/docs/StubRequests/ArgumentValidation.html +309 -0
- data/docs/StubRequests/Endpoint.html +1187 -0
- data/docs/StubRequests/EndpointNotFound.html +157 -0
- data/docs/StubRequests/EndpointRegistry.html +1527 -0
- data/docs/StubRequests/Error.html +153 -0
- data/docs/StubRequests/HashUtil.html +304 -0
- data/docs/StubRequests/InvalidType.html +252 -0
- data/docs/StubRequests/InvalidUri.html +252 -0
- data/docs/StubRequests/Service.html +1307 -0
- data/docs/StubRequests/ServiceHaveEndpoints.html +244 -0
- data/docs/StubRequests/ServiceNotFound.html +252 -0
- data/docs/StubRequests/ServiceRegistry.html +1031 -0
- data/docs/StubRequests/URI/Builder.html +1194 -0
- data/docs/StubRequests/URI/Scheme.html +315 -0
- data/docs/StubRequests/URI/Suffix.html +315 -0
- data/docs/StubRequests/URI/Validator.html +770 -0
- data/docs/StubRequests/URI.html +144 -0
- data/docs/StubRequests/UriSegmentMismatch.html +157 -0
- data/docs/StubRequests/WebMockBuilder.html +887 -0
- data/docs/StubRequests.html +452 -0
- data/docs/Time.html +232 -0
- data/docs/TrueClass.html +232 -0
- data/docs/_config.yml +1 -0
- data/docs/_index.html +391 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +496 -0
- data/docs/file.README.html +225 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +225 -0
- data/docs/js/app.js +292 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +707 -0
- data/docs/top-level-namespace.html +112 -0
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/webmock_2.3.gemfile +8 -0
- data/gemfiles/webmock_2.3.gemfile.lock +206 -0
- data/gemfiles/webmock_3.5.gemfile +8 -0
- data/gemfiles/webmock_3.5.gemfile.lock +206 -0
- data/gemfiles/webmock_develop.gemfile +8 -0
- data/gemfiles/webmock_develop.gemfile.lock +211 -0
- data/lib/stub_requests/version.rb +1 -1
- data/lib/tasks/changelog.rake +18 -0
- data/lib/tasks/gem.rake +15 -0
- data/lib/tasks/git.rake +40 -0
- data/stub_requests.gemspec +23 -12
- metadata +138 -25
data/docs/Object.html
ADDED
@@ -0,0 +1,396 @@
|
|
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
|
+
— 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> »
|
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> ⇒ 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'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> ⇒ 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'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> ⇒ 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'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> ⇒ <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's false, empty, or a whitespace string.
|
215
|
+
For example, +nil+, '', ' ', [], {}, 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> ⇒ <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'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 || 'US'</p>
|
286
|
+
|
287
|
+
<p>becomes</p>
|
288
|
+
|
289
|
+
<p>region = params[:state].presence || params[:country].presence || 'US'</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> ⇒ <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'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
ADDED
@@ -0,0 +1,298 @@
|
|
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
|
+
— 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> »
|
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> ⇒ 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'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> ⇒ <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's empty or contains whitespaces only:</p>
|
220
|
+
|
221
|
+
<p>''.blank? # => true
|
222
|
+
' '.blank? # => true
|
223
|
+
"\t\n\r".blank? # => true
|
224
|
+
' blah '.blank? # => false</p>
|
225
|
+
|
226
|
+
<p>Unicode whitespace is supported:</p>
|
227
|
+
|
228
|
+
<p>"\u00a0".blank? # => 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>
|