sinatra-param 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 677024a927239579882a3b2704ba877a74681056
4
- data.tar.gz: afb52e16b6977a93b758620db199fff2b99fb87e
3
+ metadata.gz: bf5f1311ba75a60c4d17f503747120635cb7136e
4
+ data.tar.gz: b46df70795c76b593aac58002e2b97119838c545
5
5
  SHA512:
6
- metadata.gz: fe0e5afbe4f15d5007cfff11267ceeebf4edb33dbc60e5952fb044238fb92f7f6c72a87839b35716f9cda78e0320429027d09b24666beaec8eee745aae5d3dd5
7
- data.tar.gz: 260669c49e78b131d802fdb838af6d33edca7b551424e1a9732fd0322800f7709fed8e4a7188a5cc2c4b836a1a1b78085ca9a53763c7173e2b561a79329f2dff
6
+ metadata.gz: 653a105893940b08c122286974d4b85096063364c41c2b15ac1fafe7aede753cd9522ba70a97cee11063973296cb3189141b34c1e4ae2e585e8e5948c22439c0
7
+ data.tar.gz: 93bbae31f59d4a92fd3bb899e545bde01af2e5dc032cba714cabb747fba2910994c6b4147961bec0d23010d6b1606aa7e2bde7c196723653c36021af59ceba53
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sinatra-param (1.0.2)
4
+ sinatra-param (1.0.3)
5
5
  sinatra (~> 1.3)
6
6
 
7
7
  GEM
data/coverage/index.html CHANGED
@@ -3,38 +3,38 @@
3
3
  <head>
4
4
  <title>Code coverage for Sinatra-param</title>
5
5
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
- <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
6
+ <script src='./assets/0.7.1/application.js' type='text/javascript'></script>
7
7
  <link href='./assets/0.7.1/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
8
- <link rel="shortcut icon" type="image/png" href="./assets/0.7.1/favicon_red.png" />
8
+ <link rel="shortcut icon" type="image/png" href="./assets/0.7.1/favicon_green.png" />
9
9
  <link rel="icon" type="image/png" href="./assets/0.7.1/favicon.png" />
10
10
  </head>
11
-
11
+
12
12
  <body>
13
13
  <div id="loading">
14
14
  <img src="./assets/0.7.1/loading.gif" alt="loading"/>
15
15
  </div>
16
16
  <div id="wrapper" style="display:none;">
17
- <div class="timestamp">Generated <abbr class="timeago" title="2013-01-20T22:57:14-08:00">2013-01-20T22:57:14-08:00</abbr></div>
17
+ <div class="timestamp">Generated <abbr class="timeago" title="2013-12-02T12:12:13-08:00">2013-12-02T12:12:13-08:00</abbr></div>
18
18
  <ul class="group_tabs"></ul>
19
19
 
20
20
  <div id="content">
21
21
  <div class="file_list_container" id="AllFiles">
22
22
  <h2>
23
23
  <span class="group_name">All Files</span>
24
- (<span class="covered_percent"><span class="red">28.57%</span></span>
24
+ (<span class="covered_percent"><span class="green">100.0%</span></span>
25
25
  covered at
26
26
  <span class="covered_strength">
27
- <span class="red">
28
- 0.65
27
+ <span class="green">
28
+ 18.4
29
29
  </span>
30
30
  </span> hits/line)
31
31
  </h2>
32
32
  <a name="AllFiles"></a>
33
33
  <div>
34
- <b>2</b> files in total.
35
- <b>63</b> relevant lines.
36
- <span class="green"><b>18</b> lines covered</span> and
37
- <span class="red"><b>45</b> lines missed </span>
34
+ <b>1</b> files in total.
35
+ <b>64</b> relevant lines.
36
+ <span class="green"><b>64</b> lines covered</span> and
37
+ <span class="red"><b>0</b> lines missed </span>
38
38
  </div>
39
39
  <table class="file_list">
40
40
  <thead>
@@ -49,739 +49,723 @@
49
49
  </tr>
50
50
  </thead>
51
51
  <tbody>
52
-
52
+
53
53
  <tr>
54
54
  <td class="strong"><a href="#0f7926ededdfd8418773c107837b6dc4182659b8" class="src_link" title="lib/sinatra/param.rb">lib/sinatra/param.rb</a></td>
55
- <td class="red strong">25.0 %</td>
56
- <td>105</td>
57
- <td>60</td>
58
- <td>15</td>
59
- <td>45</td>
60
- <td>0.3</td>
61
- </tr>
62
-
63
- <tr>
64
- <td class="strong"><a href="#95bc1568394aeedcc2389ae1301b3fd7e08bf109" class="src_link" title="lib/sinatra/param/version.rb">lib/sinatra/param/version.rb</a></td>
65
55
  <td class="green strong">100.0 %</td>
66
- <td>5</td>
67
- <td>3</td>
68
- <td>3</td>
56
+ <td>112</td>
57
+ <td>64</td>
58
+ <td>64</td>
69
59
  <td>0</td>
70
- <td>1.0</td>
60
+ <td>18.4</td>
71
61
  </tr>
72
-
62
+
73
63
  </tbody>
74
64
  </table>
75
65
  </div>
76
66
 
77
67
 
78
-
68
+
79
69
  </div>
80
-
70
+
81
71
  <div id="footer">
82
- Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
72
+ Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.7.1
83
73
  and simplecov-html v0.7.1<br/>
84
74
  using RSpec
85
75
  </div>
86
-
76
+
87
77
  <div class="source_files">
88
-
78
+
89
79
  <div class="source_table" id="0f7926ededdfd8418773c107837b6dc4182659b8">
90
80
  <div class="header">
91
81
  <h3>lib/sinatra/param.rb</h3>
92
- <h4><span class="red">25.0 %</span> covered</h4>
82
+ <h4><span class="green">100.0 %</span> covered</h4>
93
83
  <div>
94
- <b>60</b> relevant lines.
95
- <span class="green"><b>15</b> lines covered</span> and
96
- <span class="red"><b>45</b> lines missed.</span>
84
+ <b>64</b> relevant lines.
85
+ <span class="green"><b>64</b> lines covered</span> and
86
+ <span class="red"><b>0</b> lines missed.</span>
97
87
  </div>
98
88
  </div>
99
-
89
+
100
90
  <pre>
101
91
  <ol>
102
-
92
+
103
93
  <li class="covered" data-hits="1" data-linenumber="1">
104
94
  <span class="hits">1</span>
105
-
106
- <code class="ruby">require 'sinatra/base'</code>
95
+
96
+ <code class="ruby">require &#39;sinatra/base&#39;</code>
107
97
  </li>
108
-
98
+
109
99
  <li class="covered" data-hits="1" data-linenumber="2">
110
100
  <span class="hits">1</span>
111
-
112
- <code class="ruby">require 'sinatra/param/version'</code>
101
+
102
+ <code class="ruby">require &#39;sinatra/param/version&#39;</code>
113
103
  </li>
114
-
104
+
115
105
  <li class="covered" data-hits="1" data-linenumber="3">
116
106
  <span class="hits">1</span>
117
-
118
- <code class="ruby">require 'time'</code>
107
+
108
+ <code class="ruby">require &#39;time&#39;</code>
119
109
  </li>
120
-
110
+
121
111
  <li class="covered" data-hits="1" data-linenumber="4">
122
112
  <span class="hits">1</span>
123
-
124
- <code class="ruby">require 'date'</code>
113
+
114
+ <code class="ruby">require &#39;date&#39;</code>
125
115
  </li>
126
-
116
+
127
117
  <li class="never" data-hits="" data-linenumber="5">
128
-
129
-
118
+
119
+
130
120
  <code class="ruby"></code>
131
121
  </li>
132
-
122
+
133
123
  <li class="covered" data-hits="1" data-linenumber="6">
134
124
  <span class="hits">1</span>
135
-
125
+
136
126
  <code class="ruby">module Sinatra</code>
137
127
  </li>
138
-
128
+
139
129
  <li class="covered" data-hits="1" data-linenumber="7">
140
130
  <span class="hits">1</span>
141
-
131
+
142
132
  <code class="ruby"> module Param</code>
143
133
  </li>
144
-
134
+
145
135
  <li class="covered" data-hits="1" data-linenumber="8">
146
136
  <span class="hits">1</span>
147
-
148
- <code class="ruby"> class InvalidParameterError &lt; StandardError; end</code>
137
+
138
+ <code class="ruby"> Boolean = :boolean</code>
149
139
  </li>
150
-
140
+
151
141
  <li class="never" data-hits="" data-linenumber="9">
152
-
153
-
142
+
143
+
154
144
  <code class="ruby"></code>
155
145
  </li>
156
-
146
+
157
147
  <li class="covered" data-hits="1" data-linenumber="10">
158
148
  <span class="hits">1</span>
159
-
149
+
150
+ <code class="ruby"> class InvalidParameterError &lt; StandardError; end</code>
151
+ </li>
152
+
153
+ <li class="never" data-hits="" data-linenumber="11">
154
+
155
+
156
+ <code class="ruby"></code>
157
+ </li>
158
+
159
+ <li class="covered" data-hits="1" data-linenumber="12">
160
+ <span class="hits">1</span>
161
+
160
162
  <code class="ruby"> def param(name, type, options = {})</code>
161
163
  </li>
162
-
163
- <li class="missed" data-hits="0" data-linenumber="11">
164
-
165
-
166
- <code class="ruby"> begin</code>
164
+
165
+ <li class="covered" data-hits="76" data-linenumber="13">
166
+ <span class="hits">76</span>
167
+
168
+ <code class="ruby"> name = name.to_s</code>
167
169
  </li>
168
-
169
- <li class="missed" data-hits="0" data-linenumber="12">
170
-
171
-
172
- <code class="ruby"> params[name] = coerce(params[name], type, options) || options[:default]</code>
170
+
171
+ <li class="never" data-hits="" data-linenumber="14">
172
+
173
+
174
+ <code class="ruby"></code>
173
175
  </li>
174
-
175
- <li class="missed" data-hits="0" data-linenumber="13">
176
-
177
-
176
+
177
+ <li class="covered" data-hits="76" data-linenumber="15">
178
+ <span class="hits">76</span>
179
+
180
+ <code class="ruby"> return unless params.member?(name) or present?(options[:default]) or options[:required]</code>
181
+ </li>
182
+
183
+ <li class="never" data-hits="" data-linenumber="16">
184
+
185
+
186
+ <code class="ruby"></code>
187
+ </li>
188
+
189
+ <li class="covered" data-hits="67" data-linenumber="17">
190
+ <span class="hits">67</span>
191
+
192
+ <code class="ruby"> begin</code>
193
+ </li>
194
+
195
+ <li class="covered" data-hits="67" data-linenumber="18">
196
+ <span class="hits">67</span>
197
+
198
+ <code class="ruby"> params[name] = coerce(params[name], type, options)</code>
199
+ </li>
200
+
201
+ <li class="covered" data-hits="67" data-linenumber="19">
202
+ <span class="hits">67</span>
203
+
204
+ <code class="ruby"> params[name] = options[:default] if params[name].nil? and options[:default]</code>
205
+ </li>
206
+
207
+ <li class="covered" data-hits="67" data-linenumber="20">
208
+ <span class="hits">67</span>
209
+
178
210
  <code class="ruby"> params[name] = options[:transform].to_proc.call(params[name]) if options[:transform]</code>
179
211
  </li>
180
-
181
- <li class="missed" data-hits="0" data-linenumber="14">
182
-
183
-
212
+
213
+ <li class="covered" data-hits="67" data-linenumber="21">
214
+ <span class="hits">67</span>
215
+
184
216
  <code class="ruby"> validate!(params[name], options)</code>
185
217
  </li>
186
-
187
- <li class="never" data-hits="" data-linenumber="15">
188
-
189
-
218
+
219
+ <li class="never" data-hits="" data-linenumber="22">
220
+
221
+
190
222
  <code class="ruby"> rescue</code>
191
223
  </li>
192
-
193
- <li class="missed" data-hits="0" data-linenumber="16">
194
-
195
-
224
+
225
+ <li class="covered" data-hits="13" data-linenumber="23">
226
+ <span class="hits">13</span>
227
+
196
228
  <code class="ruby"> error = &quot;Invalid parameter, #{name}&quot;</code>
197
229
  </li>
198
-
199
- <li class="missed" data-hits="0" data-linenumber="17">
200
-
201
-
230
+
231
+ <li class="covered" data-hits="13" data-linenumber="24">
232
+ <span class="hits">13</span>
233
+
202
234
  <code class="ruby"> if content_type and content_type.match(mime_type(:json))</code>
203
235
  </li>
204
-
205
- <li class="missed" data-hits="0" data-linenumber="18">
206
-
207
-
236
+
237
+ <li class="covered" data-hits="13" data-linenumber="25">
238
+ <span class="hits">13</span>
239
+
208
240
  <code class="ruby"> error = {message: error}.to_json</code>
209
241
  </li>
210
-
211
- <li class="never" data-hits="" data-linenumber="19">
212
-
213
-
242
+
243
+ <li class="never" data-hits="" data-linenumber="26">
244
+
245
+
214
246
  <code class="ruby"> end</code>
215
247
  </li>
216
-
217
- <li class="never" data-hits="" data-linenumber="20">
218
-
219
-
248
+
249
+ <li class="never" data-hits="" data-linenumber="27">
250
+
251
+
220
252
  <code class="ruby"></code>
221
253
  </li>
222
-
223
- <li class="missed" data-hits="0" data-linenumber="21">
224
-
225
-
254
+
255
+ <li class="covered" data-hits="13" data-linenumber="28">
256
+ <span class="hits">13</span>
257
+
226
258
  <code class="ruby"> halt 400, error</code>
227
259
  </li>
228
-
229
- <li class="never" data-hits="" data-linenumber="22">
230
-
231
-
260
+
261
+ <li class="never" data-hits="" data-linenumber="29">
262
+
263
+
232
264
  <code class="ruby"> end</code>
233
265
  </li>
234
-
235
- <li class="never" data-hits="" data-linenumber="23">
236
-
237
-
266
+
267
+ <li class="never" data-hits="" data-linenumber="30">
268
+
269
+
238
270
  <code class="ruby"> end</code>
239
271
  </li>
240
-
241
- <li class="never" data-hits="" data-linenumber="24">
242
-
243
-
272
+
273
+ <li class="never" data-hits="" data-linenumber="31">
274
+
275
+
244
276
  <code class="ruby"></code>
245
277
  </li>
246
-
247
- <li class="covered" data-hits="1" data-linenumber="25">
278
+
279
+ <li class="covered" data-hits="1" data-linenumber="32">
248
280
  <span class="hits">1</span>
249
-
281
+
250
282
  <code class="ruby"> def one_of(*names)</code>
251
283
  </li>
252
-
253
- <li class="missed" data-hits="0" data-linenumber="26">
254
-
255
-
284
+
285
+ <li class="covered" data-hits="6" data-linenumber="33">
286
+ <span class="hits">6</span>
287
+
256
288
  <code class="ruby"> count = 0</code>
257
289
  </li>
258
-
259
- <li class="missed" data-hits="0" data-linenumber="27">
260
-
261
-
290
+
291
+ <li class="covered" data-hits="6" data-linenumber="34">
292
+ <span class="hits">6</span>
293
+
262
294
  <code class="ruby"> names.each do |name|</code>
263
295
  </li>
264
-
265
- <li class="missed" data-hits="0" data-linenumber="28">
266
-
267
-
296
+
297
+ <li class="covered" data-hits="16" data-linenumber="35">
298
+ <span class="hits">16</span>
299
+
268
300
  <code class="ruby"> if params[name] and present?(params[name])</code>
269
301
  </li>
270
-
271
- <li class="missed" data-hits="0" data-linenumber="29">
272
-
273
-
302
+
303
+ <li class="covered" data-hits="9" data-linenumber="36">
304
+ <span class="hits">9</span>
305
+
274
306
  <code class="ruby"> count += 1</code>
275
307
  </li>
276
-
277
- <li class="missed" data-hits="0" data-linenumber="30">
278
-
279
-
308
+
309
+ <li class="covered" data-hits="9" data-linenumber="37">
310
+ <span class="hits">9</span>
311
+
280
312
  <code class="ruby"> next unless count &gt; 1</code>
281
313
  </li>
282
-
283
- <li class="never" data-hits="" data-linenumber="31">
284
-
285
-
314
+
315
+ <li class="never" data-hits="" data-linenumber="38">
316
+
317
+
286
318
  <code class="ruby"></code>
287
319
  </li>
288
-
289
- <li class="missed" data-hits="0" data-linenumber="32">
290
-
291
-
292
- <code class="ruby"> error = &quot;Parameters #{names.join(', ')} are mutually exclusive&quot;</code>
320
+
321
+ <li class="covered" data-hits="3" data-linenumber="39">
322
+ <span class="hits">3</span>
323
+
324
+ <code class="ruby"> error = &quot;Parameters #{names.join(&#39;, &#39;)} are mutually exclusive&quot;</code>
293
325
  </li>
294
-
295
- <li class="missed" data-hits="0" data-linenumber="33">
296
-
297
-
326
+
327
+ <li class="covered" data-hits="3" data-linenumber="40">
328
+ <span class="hits">3</span>
329
+
298
330
  <code class="ruby"> if content_type and content_type.match(mime_type(:json))</code>
299
331
  </li>
300
-
301
- <li class="missed" data-hits="0" data-linenumber="34">
302
-
303
-
332
+
333
+ <li class="covered" data-hits="3" data-linenumber="41">
334
+ <span class="hits">3</span>
335
+
304
336
  <code class="ruby"> error = {message: error}.to_json</code>
305
337
  </li>
306
-
307
- <li class="never" data-hits="" data-linenumber="35">
308
-
309
-
338
+
339
+ <li class="never" data-hits="" data-linenumber="42">
340
+
341
+
310
342
  <code class="ruby"> end</code>
311
343
  </li>
312
-
313
- <li class="never" data-hits="" data-linenumber="36">
314
-
315
-
344
+
345
+ <li class="never" data-hits="" data-linenumber="43">
346
+
347
+
316
348
  <code class="ruby"></code>
317
349
  </li>
318
-
319
- <li class="missed" data-hits="0" data-linenumber="37">
320
-
321
-
350
+
351
+ <li class="covered" data-hits="3" data-linenumber="44">
352
+ <span class="hits">3</span>
353
+
322
354
  <code class="ruby"> halt 400, error</code>
323
355
  </li>
324
-
325
- <li class="never" data-hits="" data-linenumber="38">
326
-
327
-
356
+
357
+ <li class="never" data-hits="" data-linenumber="45">
358
+
359
+
328
360
  <code class="ruby"> end</code>
329
361
  </li>
330
-
331
- <li class="never" data-hits="" data-linenumber="39">
332
-
333
-
362
+
363
+ <li class="never" data-hits="" data-linenumber="46">
364
+
365
+
334
366
  <code class="ruby"> end</code>
335
367
  </li>
336
-
337
- <li class="never" data-hits="" data-linenumber="40">
338
-
339
-
368
+
369
+ <li class="never" data-hits="" data-linenumber="47">
370
+
371
+
340
372
  <code class="ruby"> end</code>
341
373
  </li>
342
-
343
- <li class="never" data-hits="" data-linenumber="41">
344
-
345
-
374
+
375
+ <li class="never" data-hits="" data-linenumber="48">
376
+
377
+
346
378
  <code class="ruby"></code>
347
379
  </li>
348
-
349
- <li class="covered" data-hits="1" data-linenumber="42">
380
+
381
+ <li class="covered" data-hits="1" data-linenumber="49">
350
382
  <span class="hits">1</span>
351
-
383
+
352
384
  <code class="ruby"> private</code>
353
385
  </li>
354
-
355
- <li class="never" data-hits="" data-linenumber="43">
356
-
357
-
386
+
387
+ <li class="never" data-hits="" data-linenumber="50">
388
+
389
+
358
390
  <code class="ruby"></code>
359
391
  </li>
360
-
361
- <li class="covered" data-hits="1" data-linenumber="44">
392
+
393
+ <li class="covered" data-hits="1" data-linenumber="51">
362
394
  <span class="hits">1</span>
363
-
395
+
364
396
  <code class="ruby"> def coerce(param, type, options = {})</code>
365
397
  </li>
366
-
367
- <li class="missed" data-hits="0" data-linenumber="45">
368
-
369
-
398
+
399
+ <li class="covered" data-hits="67" data-linenumber="52">
400
+ <span class="hits">67</span>
401
+
370
402
  <code class="ruby"> return nil if param.nil?</code>
371
403
  </li>
372
-
373
- <li class="missed" data-hits="0" data-linenumber="46">
374
-
375
-
404
+
405
+ <li class="covered" data-hits="64" data-linenumber="53">
406
+ <span class="hits">64</span>
407
+
376
408
  <code class="ruby"> return param if (param.is_a?(type) rescue false)</code>
377
409
  </li>
378
-
379
- <li class="missed" data-hits="0" data-linenumber="47">
380
-
381
-
410
+
411
+ <li class="covered" data-hits="39" data-linenumber="54">
412
+ <span class="hits">39</span>
413
+
382
414
  <code class="ruby"> return Integer(param) if type == Integer</code>
383
415
  </li>
384
-
385
- <li class="missed" data-hits="0" data-linenumber="48">
386
-
387
-
416
+
417
+ <li class="covered" data-hits="30" data-linenumber="55">
418
+ <span class="hits">30</span>
419
+
388
420
  <code class="ruby"> return Float(param) if type == Float</code>
389
421
  </li>
390
-
391
- <li class="missed" data-hits="0" data-linenumber="49">
392
-
393
-
422
+
423
+ <li class="covered" data-hits="29" data-linenumber="56">
424
+ <span class="hits">29</span>
425
+
394
426
  <code class="ruby"> return String(param) if type == String</code>
395
427
  </li>
396
-
397
- <li class="missed" data-hits="0" data-linenumber="50">
398
-
399
-
428
+
429
+ <li class="covered" data-hits="28" data-linenumber="57">
430
+ <span class="hits">28</span>
431
+
400
432
  <code class="ruby"> return Time.parse(param) if type == Time</code>
401
433
  </li>
402
-
403
- <li class="missed" data-hits="0" data-linenumber="51">
404
-
405
-
434
+
435
+ <li class="covered" data-hits="27" data-linenumber="58">
436
+ <span class="hits">27</span>
437
+
406
438
  <code class="ruby"> return Date.parse(param) if type == Date</code>
407
439
  </li>
408
-
409
- <li class="missed" data-hits="0" data-linenumber="52">
410
-
411
-
440
+
441
+ <li class="covered" data-hits="26" data-linenumber="59">
442
+ <span class="hits">26</span>
443
+
412
444
  <code class="ruby"> return DateTime.parse(param) if type == DateTime</code>
413
445
  </li>
414
-
415
- <li class="missed" data-hits="0" data-linenumber="53">
416
-
417
-
446
+
447
+ <li class="covered" data-hits="25" data-linenumber="60">
448
+ <span class="hits">25</span>
449
+
418
450
  <code class="ruby"> return Array(param.split(options[:delimiter] || &quot;,&quot;)) if type == Array</code>
419
451
  </li>
420
-
421
- <li class="missed" data-hits="0" data-linenumber="54">
422
-
423
-
452
+
453
+ <li class="covered" data-hits="25" data-linenumber="61">
454
+ <span class="hits">25</span>
455
+
424
456
  <code class="ruby"> return Hash[param.split(options[:delimiter] || &quot;,&quot;).map{|c| c.split(options[:separator] || &quot;:&quot;)}] if type == Hash</code>
425
457
  </li>
426
-
427
- <li class="missed" data-hits="0" data-linenumber="55">
428
-
429
-
430
- <code class="ruby"> return (/(false|f|no|n|0)$/i === param.to_s ? false : (/(true|t|yes|y|1)$/i === param.to_s ? true : nil)) if type == TrueClass || type == FalseClass || type == :boolean</code>
458
+
459
+ <li class="covered" data-hits="21" data-linenumber="62">
460
+ <span class="hits">21</span>
461
+
462
+ <code class="ruby"> return (/(false|f|no|n|0)$/i === param.to_s ? false : (/(true|t|yes|y|1)$/i === param.to_s ? true : nil)) if type == TrueClass || type == FalseClass || type == Boolean</code>
431
463
  </li>
432
-
433
- <li class="never" data-hits="" data-linenumber="56">
434
-
435
-
464
+
465
+ <li class="never" data-hits="" data-linenumber="63">
466
+
467
+
436
468
  <code class="ruby"> return nil</code>
437
469
  </li>
438
-
439
- <li class="never" data-hits="" data-linenumber="57">
440
-
441
-
470
+
471
+ <li class="never" data-hits="" data-linenumber="64">
472
+
473
+
442
474
  <code class="ruby"> end</code>
443
475
  </li>
444
-
445
- <li class="never" data-hits="" data-linenumber="58">
446
-
447
-
476
+
477
+ <li class="never" data-hits="" data-linenumber="65">
478
+
479
+
448
480
  <code class="ruby"></code>
449
481
  </li>
450
-
451
- <li class="covered" data-hits="1" data-linenumber="59">
482
+
483
+ <li class="covered" data-hits="1" data-linenumber="66">
452
484
  <span class="hits">1</span>
453
-
485
+
454
486
  <code class="ruby"> def validate!(param, options)</code>
455
487
  </li>
456
-
457
- <li class="missed" data-hits="0" data-linenumber="60">
458
-
459
-
488
+
489
+ <li class="covered" data-hits="67" data-linenumber="67">
490
+ <span class="hits">67</span>
491
+
460
492
  <code class="ruby"> options.each do |key, value|</code>
461
493
  </li>
462
-
463
- <li class="missed" data-hits="0" data-linenumber="61">
464
-
465
-
494
+
495
+ <li class="covered" data-hits="38" data-linenumber="68">
496
+ <span class="hits">38</span>
497
+
466
498
  <code class="ruby"> case key</code>
467
499
  </li>
468
-
469
- <li class="never" data-hits="" data-linenumber="62">
470
-
471
-
500
+
501
+ <li class="never" data-hits="" data-linenumber="69">
502
+
503
+
472
504
  <code class="ruby"> when :required</code>
473
505
  </li>
474
-
475
- <li class="missed" data-hits="0" data-linenumber="63">
476
-
477
-
506
+
507
+ <li class="covered" data-hits="3" data-linenumber="70">
508
+ <span class="hits">3</span>
509
+
478
510
  <code class="ruby"> raise InvalidParameterError if value &amp;&amp; param.nil?</code>
479
511
  </li>
480
-
481
- <li class="never" data-hits="" data-linenumber="64">
482
-
483
-
512
+
513
+ <li class="never" data-hits="" data-linenumber="71">
514
+
515
+
484
516
  <code class="ruby"> when :blank</code>
485
517
  </li>
486
-
487
- <li class="never" data-hits="" data-linenumber="65">
488
-
489
-
518
+
519
+ <li class="never" data-hits="" data-linenumber="72">
520
+
521
+
490
522
  <code class="ruby"> raise InvalidParameterError if !value &amp;&amp; case param</code>
491
523
  </li>
492
-
493
- <li class="never" data-hits="" data-linenumber="66">
494
-
495
-
524
+
525
+ <li class="never" data-hits="" data-linenumber="73">
526
+
527
+
496
528
  <code class="ruby"> when String</code>
497
529
  </li>
498
-
499
- <li class="missed" data-hits="0" data-linenumber="67">
500
-
501
-
530
+
531
+ <li class="covered" data-hits="1" data-linenumber="74">
532
+ <span class="hits">1</span>
533
+
502
534
  <code class="ruby"> !(/\S/ === param)</code>
503
535
  </li>
504
-
505
- <li class="never" data-hits="" data-linenumber="68">
506
-
507
-
536
+
537
+ <li class="never" data-hits="" data-linenumber="75">
538
+
539
+
508
540
  <code class="ruby"> when Array, Hash</code>
509
541
  </li>
510
-
511
- <li class="missed" data-hits="0" data-linenumber="69">
512
-
513
-
542
+
543
+ <li class="covered" data-hits="2" data-linenumber="76">
544
+ <span class="hits">2</span>
545
+
514
546
  <code class="ruby"> param.empty?</code>
515
547
  </li>
516
-
517
- <li class="never" data-hits="" data-linenumber="70">
518
-
519
-
548
+
549
+ <li class="never" data-hits="" data-linenumber="77">
550
+
551
+
520
552
  <code class="ruby"> else</code>
521
553
  </li>
522
-
523
- <li class="missed" data-hits="0" data-linenumber="71">
524
-
525
-
554
+
555
+ <li class="covered" data-hits="1" data-linenumber="78">
556
+ <span class="hits">1</span>
557
+
526
558
  <code class="ruby"> param.nil?</code>
527
559
  </li>
528
-
529
- <li class="missed" data-hits="0" data-linenumber="72">
530
-
531
-
560
+
561
+ <li class="covered" data-hits="5" data-linenumber="79">
562
+ <span class="hits">5</span>
563
+
532
564
  <code class="ruby"> end</code>
533
565
  </li>
534
-
535
- <li class="never" data-hits="" data-linenumber="73">
536
-
537
-
566
+
567
+ <li class="never" data-hits="" data-linenumber="80">
568
+
569
+
538
570
  <code class="ruby"> when :is</code>
539
571
  </li>
540
-
541
- <li class="missed" data-hits="0" data-linenumber="74">
542
-
543
-
572
+
573
+ <li class="covered" data-hits="2" data-linenumber="81">
574
+ <span class="hits">2</span>
575
+
544
576
  <code class="ruby"> raise InvalidParameterError unless value === param</code>
545
577
  </li>
546
-
547
- <li class="never" data-hits="" data-linenumber="75">
548
-
549
-
578
+
579
+ <li class="never" data-hits="" data-linenumber="82">
580
+
581
+
550
582
  <code class="ruby"> when :in, :within, :range</code>
551
583
  </li>
552
-
553
- <li class="never" data-hits="" data-linenumber="76">
554
-
555
-
584
+
585
+ <li class="never" data-hits="" data-linenumber="83">
586
+
587
+
556
588
  <code class="ruby"> raise InvalidParameterError unless param.nil? || case value</code>
557
589
  </li>
558
-
559
- <li class="never" data-hits="" data-linenumber="77">
560
-
561
-
590
+
591
+ <li class="never" data-hits="" data-linenumber="84">
592
+
593
+
562
594
  <code class="ruby"> when Range</code>
563
595
  </li>
564
-
565
- <li class="missed" data-hits="0" data-linenumber="78">
566
-
567
-
596
+
597
+ <li class="covered" data-hits="4" data-linenumber="85">
598
+ <span class="hits">4</span>
599
+
568
600
  <code class="ruby"> value.include?(param)</code>
569
601
  </li>
570
-
571
- <li class="never" data-hits="" data-linenumber="79">
572
-
573
-
602
+
603
+ <li class="never" data-hits="" data-linenumber="86">
604
+
605
+
574
606
  <code class="ruby"> else</code>
575
607
  </li>
576
-
577
- <li class="missed" data-hits="0" data-linenumber="80">
578
-
579
-
608
+
609
+ <li class="covered" data-hits="2" data-linenumber="87">
610
+ <span class="hits">2</span>
611
+
580
612
  <code class="ruby"> Array(value).include?(param)</code>
581
613
  </li>
582
-
583
- <li class="missed" data-hits="0" data-linenumber="81">
584
-
585
-
614
+
615
+ <li class="covered" data-hits="6" data-linenumber="88">
616
+ <span class="hits">6</span>
617
+
586
618
  <code class="ruby"> end</code>
587
619
  </li>
588
-
589
- <li class="never" data-hits="" data-linenumber="82">
590
-
591
-
620
+
621
+ <li class="never" data-hits="" data-linenumber="89">
622
+
623
+
592
624
  <code class="ruby"> when :min</code>
593
625
  </li>
594
-
595
- <li class="missed" data-hits="0" data-linenumber="83">
596
-
597
-
626
+
627
+ <li class="covered" data-hits="2" data-linenumber="90">
628
+ <span class="hits">2</span>
629
+
598
630
  <code class="ruby"> raise InvalidParameterError unless param.nil? || value &lt;= param</code>
599
631
  </li>
600
-
601
- <li class="never" data-hits="" data-linenumber="84">
602
-
603
-
632
+
633
+ <li class="never" data-hits="" data-linenumber="91">
634
+
635
+
604
636
  <code class="ruby"> when :max</code>
605
637
  </li>
606
-
607
- <li class="missed" data-hits="0" data-linenumber="85">
608
-
609
-
638
+
639
+ <li class="covered" data-hits="2" data-linenumber="92">
640
+ <span class="hits">2</span>
641
+
610
642
  <code class="ruby"> raise InvalidParameterError unless param.nil? || value &gt;= param</code>
611
643
  </li>
612
-
613
- <li class="never" data-hits="" data-linenumber="86">
614
-
615
-
644
+
645
+ <li class="never" data-hits="" data-linenumber="93">
646
+
647
+
616
648
  <code class="ruby"> when :min_length</code>
617
649
  </li>
618
-
619
- <li class="missed" data-hits="0" data-linenumber="87">
620
-
621
-
650
+
651
+ <li class="covered" data-hits="1" data-linenumber="94">
652
+ <span class="hits">1</span>
653
+
622
654
  <code class="ruby"> raise InvalidParameterError unless param.nil? || value &lt;= param.length</code>
623
655
  </li>
624
-
625
- <li class="never" data-hits="" data-linenumber="88">
626
-
627
-
656
+
657
+ <li class="never" data-hits="" data-linenumber="95">
658
+
659
+
628
660
  <code class="ruby"> when :max_length</code>
629
661
  </li>
630
-
631
- <li class="missed" data-hits="0" data-linenumber="89">
632
-
633
-
662
+
663
+ <li class="covered" data-hits="3" data-linenumber="96">
664
+ <span class="hits">3</span>
665
+
634
666
  <code class="ruby"> raise InvalidParameterError unless param.nil? || value &gt;= param.length</code>
635
667
  </li>
636
-
637
- <li class="never" data-hits="" data-linenumber="90">
638
-
639
-
668
+
669
+ <li class="never" data-hits="" data-linenumber="97">
670
+
671
+
640
672
  <code class="ruby"> end</code>
641
673
  </li>
642
-
643
- <li class="never" data-hits="" data-linenumber="91">
644
-
645
-
674
+
675
+ <li class="never" data-hits="" data-linenumber="98">
676
+
677
+
646
678
  <code class="ruby"> end</code>
647
679
  </li>
648
-
649
- <li class="never" data-hits="" data-linenumber="92">
650
-
651
-
680
+
681
+ <li class="never" data-hits="" data-linenumber="99">
682
+
683
+
652
684
  <code class="ruby"> end</code>
653
685
  </li>
654
-
655
- <li class="never" data-hits="" data-linenumber="93">
656
-
657
-
686
+
687
+ <li class="never" data-hits="" data-linenumber="100">
688
+
689
+
658
690
  <code class="ruby"></code>
659
691
  </li>
660
-
661
- <li class="never" data-hits="" data-linenumber="94">
662
-
663
-
692
+
693
+ <li class="never" data-hits="" data-linenumber="101">
694
+
695
+
664
696
  <code class="ruby"> # ActiveSupport #present? and #blank? without patching Object</code>
665
697
  </li>
666
-
667
- <li class="covered" data-hits="1" data-linenumber="95">
698
+
699
+ <li class="covered" data-hits="1" data-linenumber="102">
668
700
  <span class="hits">1</span>
669
-
701
+
670
702
  <code class="ruby"> def present?(object)</code>
671
703
  </li>
672
-
673
- <li class="missed" data-hits="0" data-linenumber="96">
674
-
675
-
704
+
705
+ <li class="covered" data-hits="21" data-linenumber="103">
706
+ <span class="hits">21</span>
707
+
676
708
  <code class="ruby"> !blank?(object)</code>
677
709
  </li>
678
-
679
- <li class="never" data-hits="" data-linenumber="97">
680
-
681
-
710
+
711
+ <li class="never" data-hits="" data-linenumber="104">
712
+
713
+
682
714
  <code class="ruby"> end</code>
683
715
  </li>
684
-
685
- <li class="never" data-hits="" data-linenumber="98">
686
-
687
-
716
+
717
+ <li class="never" data-hits="" data-linenumber="105">
718
+
719
+
688
720
  <code class="ruby"></code>
689
721
  </li>
690
-
691
- <li class="covered" data-hits="1" data-linenumber="99">
722
+
723
+ <li class="covered" data-hits="1" data-linenumber="106">
692
724
  <span class="hits">1</span>
693
-
725
+
694
726
  <code class="ruby"> def blank?(object)</code>
695
727
  </li>
696
-
697
- <li class="missed" data-hits="0" data-linenumber="100">
698
-
699
-
728
+
729
+ <li class="covered" data-hits="21" data-linenumber="107">
730
+ <span class="hits">21</span>
731
+
700
732
  <code class="ruby"> object.respond_to?(:empty?) ? object.empty? : !object</code>
701
733
  </li>
702
-
703
- <li class="never" data-hits="" data-linenumber="101">
704
-
705
-
734
+
735
+ <li class="never" data-hits="" data-linenumber="108">
736
+
737
+
706
738
  <code class="ruby"> end</code>
707
739
  </li>
708
-
709
- <li class="never" data-hits="" data-linenumber="102">
710
-
711
-
740
+
741
+ <li class="never" data-hits="" data-linenumber="109">
742
+
743
+
712
744
  <code class="ruby"> end</code>
713
745
  </li>
714
-
715
- <li class="never" data-hits="" data-linenumber="103">
716
-
717
-
746
+
747
+ <li class="never" data-hits="" data-linenumber="110">
748
+
749
+
718
750
  <code class="ruby"></code>
719
751
  </li>
720
-
721
- <li class="covered" data-hits="1" data-linenumber="104">
752
+
753
+ <li class="covered" data-hits="1" data-linenumber="111">
722
754
  <span class="hits">1</span>
723
-
755
+
724
756
  <code class="ruby"> helpers Param</code>
725
757
  </li>
726
-
727
- <li class="never" data-hits="" data-linenumber="105">
728
-
729
-
758
+
759
+ <li class="never" data-hits="" data-linenumber="112">
760
+
761
+
730
762
  <code class="ruby">end</code>
731
763
  </li>
732
-
764
+
733
765
  </ol>
734
766
  </pre>
735
767
  </div>
736
-
737
- <div class="source_table" id="95bc1568394aeedcc2389ae1301b3fd7e08bf109">
738
- <div class="header">
739
- <h3>lib/sinatra/param/version.rb</h3>
740
- <h4><span class="green">100.0 %</span> covered</h4>
741
- <div>
742
- <b>3</b> relevant lines.
743
- <span class="green"><b>3</b> lines covered</span> and
744
- <span class="red"><b>0</b> lines missed.</span>
745
- </div>
746
- </div>
747
-
748
- <pre>
749
- <ol>
750
-
751
- <li class="covered" data-hits="1" data-linenumber="1">
752
- <span class="hits">1</span>
753
-
754
- <code class="ruby">module Sinatra</code>
755
- </li>
756
-
757
- <li class="covered" data-hits="1" data-linenumber="2">
758
- <span class="hits">1</span>
759
-
760
- <code class="ruby"> module Param</code>
761
- </li>
762
-
763
- <li class="covered" data-hits="1" data-linenumber="3">
764
- <span class="hits">1</span>
765
-
766
- <code class="ruby"> VERSION = &quot;0.1.1&quot;</code>
767
- </li>
768
-
769
- <li class="never" data-hits="" data-linenumber="4">
770
-
771
-
772
- <code class="ruby"> end</code>
773
- </li>
774
-
775
- <li class="never" data-hits="" data-linenumber="5">
776
-
777
-
778
- <code class="ruby">end</code>
779
- </li>
780
-
781
- </ol>
782
- </pre>
783
- </div>
784
-
768
+
785
769
  </div>
786
770
  </div>
787
771
  </body>