hash_dealer 1.5.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.document +5 -0
  2. data/.rspec +3 -0
  3. data/Gemfile +4 -3
  4. data/Gemfile.lock +24 -28
  5. data/Rakefile +1 -1
  6. data/VERSION +1 -1
  7. data/hash_dealer.gemspec +33 -11
  8. data/lib/comparator.rb +6 -19
  9. data/lib/core_extensions.rb +9 -7
  10. data/lib/hash.rb +4 -21
  11. data/lib/matcher.rb +10 -9
  12. data/spec/lib/matcher_spec.rb +0 -22
  13. metadata +20 -70
  14. data/coverage/assets/0.5.3/app.js +0 -88
  15. data/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
  16. data/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
  17. data/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
  18. data/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
  19. data/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
  20. data/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
  21. data/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
  22. data/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
  23. data/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
  24. data/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
  25. data/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
  26. data/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
  27. data/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
  28. data/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
  29. data/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
  30. data/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
  31. data/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
  32. data/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
  33. data/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
  34. data/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
  35. data/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +0 -363
  36. data/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +0 -44
  37. data/coverage/assets/0.5.3/favicon_green.png +0 -0
  38. data/coverage/assets/0.5.3/favicon_red.png +0 -0
  39. data/coverage/assets/0.5.3/favicon_yellow.png +0 -0
  40. data/coverage/assets/0.5.3/highlight.css +0 -129
  41. data/coverage/assets/0.5.3/highlight.pack.js +0 -1
  42. data/coverage/assets/0.5.3/jquery-1.6.2.min.js +0 -18
  43. data/coverage/assets/0.5.3/jquery.dataTables.min.js +0 -152
  44. data/coverage/assets/0.5.3/jquery.timeago.js +0 -141
  45. data/coverage/assets/0.5.3/jquery.url.js +0 -174
  46. data/coverage/assets/0.5.3/loading.gif +0 -0
  47. data/coverage/assets/0.5.3/magnify.png +0 -0
  48. data/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  49. data/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  50. data/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  51. data/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  52. data/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  53. data/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  54. data/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  55. data/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  56. data/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
  57. data/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  58. data/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
  59. data/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
  60. data/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  61. data/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +0 -295
  62. data/coverage/assets/0.5.3/stylesheet.css +0 -383
  63. data/coverage/index.html +0 -4367
  64. data/pkg/hash_dealer-1.4.10.gem +0 -0
@@ -1,383 +0,0 @@
1
- /* -----------------------------------------------------------------------
2
-
3
-
4
- Blueprint CSS Framework 0.9
5
- http://blueprintcss.org
6
-
7
- * Copyright (c) 2007-Present. See LICENSE for more info.
8
- * See README for instructions on how to use Blueprint.
9
- * For credits and origins, see AUTHORS.
10
- * This is a compressed file. See the sources in the 'src' directory.
11
-
12
- ----------------------------------------------------------------------- */
13
-
14
- /* reset.css */
15
- html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
16
- article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;}
17
- body {line-height:1.5;}
18
- table {border-collapse:separate;border-spacing:0;}
19
- caption, th, td {text-align:left;font-weight:normal;}
20
- table, td, th {vertical-align:middle;}
21
- blockquote:before, blockquote:after, q:before, q:after {content:"";}
22
- blockquote, q {quotes:"" "";}
23
- a img {border:none;}
24
-
25
- /* typography.css */
26
- html {font-size:100.01%;}
27
- body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
28
- h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
29
- h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
30
- h2 {font-size:2em;margin-bottom:0.75em;}
31
- h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
32
- h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
33
- h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
34
- h6 {font-size:1em;font-weight:bold;}
35
- h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
36
- p {margin:0 0 1.5em;}
37
- p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
38
- p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
39
- a:focus, a:hover {color:#000;}
40
- a {color:#009;text-decoration:underline;}
41
- blockquote {margin:1.5em;color:#666;font-style:italic;}
42
- strong {font-weight:bold;}
43
- em, dfn {font-style:italic;}
44
- dfn {font-weight:bold;}
45
- sup, sub {line-height:0;}
46
- abbr, acronym {border-bottom:1px dotted #666;}
47
- address {margin:0 0 1.5em;font-style:italic;}
48
- del {color:#666;}
49
- pre {margin:1.5em 0;white-space:pre;}
50
- pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
51
- li ul, li ol {margin:0;}
52
- ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;}
53
- ul {list-style-type:disc;}
54
- ol {list-style-type:decimal;}
55
- dl {margin:0 0 1.5em 0;}
56
- dl dt {font-weight:bold;}
57
- dd {margin-left:1.5em;}
58
- table {margin-bottom:1.4em;width:100%;}
59
- th {font-weight:bold;}
60
- thead th {background:#c3d9ff;}
61
- th, td, caption {padding:4px 10px 4px 5px;}
62
- tr.even td {background:#efefef;}
63
- tfoot {font-style:italic;}
64
- caption {background:#eee;}
65
- .small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
66
- .large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
67
- .hide {display:none;}
68
- .quiet {color:#666;}
69
- .loud {color:#000;}
70
- .highlight {background:#ff0;}
71
- .added {background:#060;color:#fff;}
72
- .removed {background:#900;color:#fff;}
73
- .first {margin-left:0;padding-left:0;}
74
- .last {margin-right:0;padding-right:0;}
75
- .top {margin-top:0;padding-top:0;}
76
- .bottom {margin-bottom:0;padding-bottom:0;}
77
-
78
- /* forms.css */
79
- label {font-weight:bold;}
80
- fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
81
- legend {font-weight:bold;font-size:1.2em;}
82
- input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;}
83
- input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;}
84
- input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;}
85
- input.text, input.title {width:300px;padding:5px;}
86
- input.title {font-size:1.5em;}
87
- textarea {width:390px;height:250px;padding:5px;}
88
- input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;}
89
- form.inline {line-height:3;}
90
- form.inline p {margin-bottom:0;}
91
- .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
92
- .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
93
- .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
94
- .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
95
- .error a {color:#8a1f11;}
96
- .notice a {color:#514721;}
97
- .success a {color:#264409;}
98
- .box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
99
- hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
100
- hr.space {background:#fff;color:#fff;visibility:hidden;}
101
- .clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
102
- .clearfix, .container {display:block;}
103
- .clear {clear:both;}
104
-
105
- #loading {
106
- position: fixed;
107
- left: 40%;
108
- top: 50%;
109
- }
110
-
111
- a {
112
- color: #333;
113
- text-decoration: none;
114
- }
115
-
116
- a:hover {
117
- color: #000;
118
- text-decoration: underline;
119
- }
120
-
121
- body {
122
- font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif;
123
- padding: 12px;
124
- background-color: #333;
125
- }
126
-
127
- h1, h2, h3, h4 {
128
- color: #1C2324;
129
- margin: 0;
130
- padding: 0;
131
- margin-bottom: 12px;
132
- }
133
-
134
- table {
135
- width: 100%;
136
- }
137
-
138
- #content {
139
- clear: left;
140
- background-color: white;
141
- border: 2px solid #ddd;
142
- border-top: 8px solid #ddd;
143
- padding: 18px;
144
- -webkit-border-bottom-left-radius: 5px;
145
- -webkit-border-bottom-right-radius: 5px;
146
- -webkit-border-top-right-radius: 5px;
147
- -moz-border-radius-bottomleft: 5px;
148
- -moz-border-radius-bottomright: 5px;
149
- -moz-border-radius-topright: 5px;
150
- border-bottom-left-radius: 5px;
151
- border-bottom-right-radius: 5px;
152
- border-top-right-radius: 5px;
153
- }
154
-
155
- .dataTables_filter, .dataTables_info {
156
- padding: 2px 6px;
157
- }
158
-
159
- abbr.timeago {
160
- text-decoration: none;
161
- border: none;
162
- font-weight: bold;
163
- }
164
-
165
- .timestamp {
166
- float: right;
167
- color: #ddd;
168
- }
169
-
170
- .group_tabs {
171
- list-style: none;
172
- float: left;
173
- margin: 0;
174
- padding: 0;
175
- }
176
- .group_tabs li {
177
- display: inline;
178
- float: left;
179
- }
180
-
181
- .group_tabs li a {
182
- font-family: Helvetica, Arial, sans-serif;
183
- display: block;
184
- float: left;
185
- text-decoration: none;
186
- padding: 4px 8px;
187
- background-color: #aaa;
188
- background: -webkit-gradient(linear, 0 0, 0 bottom, from(#DDD), to(#aaa));
189
- background: -moz-linear-gradient(#DDD, #aaa);
190
- background: linear-gradient(#DDD, #aaa);
191
- text-shadow: #e5e5e5 1px 1px 0px;
192
- border-bottom: none;
193
- color: #333;
194
- font-weight: bold;
195
- margin-right: 8px;
196
- border-top: 1px solid #efefef;
197
- -webkit-border-top-left-radius: 2px;
198
- -webkit-border-top-right-radius: 2px;
199
- -moz-border-radius-topleft: 2px;
200
- -moz-border-radius-topright: 2px;
201
- border-top-left-radius: 2px;
202
- border-top-right-radius: 2px;
203
- }
204
-
205
- .group_tabs li a:hover {
206
- background-color: #ccc;
207
- background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eee), to(#aaa));
208
- background: -moz-linear-gradient(#eee, #aaa);
209
- background: linear-gradient(#eee, #aaa);
210
- }
211
-
212
- .group_tabs li a:active {
213
- padding-top: 5px;
214
- padding-bottom: 3px;
215
- }
216
-
217
- .group_tabs li.active a {
218
- color: black;
219
- text-shadow: #fff 1px 1px 0px;
220
- background-color: #ddd;
221
- background: -webkit-gradient(linear, 0 0, 0 bottom, from(#fff), to(#ddd));
222
- background: -moz-linear-gradient(#fff, #ddd);
223
- background: linear-gradient(#fff, #ddd);
224
- }
225
-
226
- .file_list {
227
- margin-bottom: 18px;
228
- }
229
-
230
- a.src_link {
231
- background: url('./magnify.png') no-repeat left 50%;
232
- padding-left: 18px;
233
- }
234
-
235
- tr, td {
236
- margin: 0;
237
- padding: 0;
238
- }
239
-
240
- th {
241
- white-space: nowrap;
242
- }
243
-
244
- th.ui-state-default {
245
- cursor: pointer;
246
- }
247
-
248
- th span.ui-icon {
249
- float: left;
250
- }
251
-
252
- td {
253
- padding: 4px 8px;
254
- }
255
-
256
- td.strong {
257
- font-weight: bold;
258
- }
259
-
260
- .source_table h3, .source_table h4 {
261
- padding: 0;
262
- margin: 0;
263
- margin-bottom: 4px;
264
- }
265
-
266
- .source_table .header {
267
- padding: 10px;
268
- }
269
-
270
- .source_table pre {
271
- margin: 0;
272
- padding: 0;
273
- white-space: normal;
274
- }
275
-
276
- .source_table pre, .source_table code {
277
- color: #000;
278
- font-family: "Monaco", "Inconsolata", "Consolas", monospace;
279
- }
280
-
281
- .source_table pre {
282
- background-color: #333;
283
- }
284
-
285
- .source_table pre ol {
286
- margin: 0px;
287
- padding: 0px;
288
- margin-left: 45px;
289
- font-size: 12px;
290
- color: white;
291
- }
292
-
293
- .source_table pre li {
294
- margin: 0px;
295
- padding: 2px 6px;
296
- border-left: 5px solid white;
297
- }
298
-
299
- .source_table pre li code {
300
- white-space: pre;
301
- white-space: pre-wrap;
302
- }
303
-
304
- .source_table pre .hits {
305
- float: right;
306
- margin-left: 10px;
307
- padding: 2px 4px;
308
-
309
- background-color: #444;
310
- background: -webkit-gradient(linear, 0 0, 0 bottom, from(#222), to(#666));
311
- background: -moz-linear-gradient(#222, #666);
312
- background: linear-gradient(#222, #666);
313
-
314
- color: white;
315
- font-family: Helvetica, "Helvetica Neue", Arial, sans-serif;
316
- font-size: 10px;
317
- font-weight: bold;
318
- text-align: center;
319
- border-radius: 6px;
320
- }
321
-
322
- #footer {
323
- color: #ddd;
324
- font-size: 12px;
325
- font-weight: bold;
326
- margin-top: 12px;
327
- text-align: right;
328
- }
329
- #footer a {
330
- color: #eee;
331
- text-decoration: underline;
332
- }
333
- #footer a:hover {
334
- color: #fff;
335
- text-decoration: none;
336
- }
337
-
338
- .green {
339
- color: #090;
340
- }
341
- .red {
342
- color: #900;
343
- }
344
- .yellow {
345
- color: #da0;
346
- }
347
- .source_table .covered {
348
- border-color: #090;
349
- }
350
- .source_table .missed {
351
- border-color: #900;
352
- }
353
- .source_table .never {
354
- border-color: black;
355
- }
356
- .source_table .skipped {
357
- border-color: #fc0;
358
- }
359
-
360
- .source_table .covered:nth-child(odd) {
361
- background-color: #CDF2CD;
362
- }
363
- .source_table .covered:nth-child(even) {
364
- background-color: #DBF2DB;
365
- }
366
- .source_table .missed:nth-child(odd) {
367
- background-color: #F7C0C0;
368
- }
369
- .source_table .missed:nth-child(even) {
370
- background-color: #F7CFCF;
371
- }
372
- .source_table .never:nth-child(odd) {
373
- background-color: #efefef;
374
- }
375
- .source_table .never:nth-child(even) {
376
- background-color: #f4f4f4;
377
- }
378
- .source_table .skipped:nth-child(odd) {
379
- background-color: #FBF0C0;
380
- }
381
- .source_table .skipped:nth-child(even) {
382
- background-color: #FBFfCf;
383
- }
@@ -1,4367 +0,0 @@
1
- <!DOCTYPE html>
2
- <html xmlns='http://www.w3.org/1999/xhtml'>
3
- <head>
4
- <title>Code coverage for Hash dealer</title>
5
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6
- <script src='./assets/0.5.3/jquery-1.6.2.min.js' type='text/javascript'></script>
7
- <script src='./assets/0.5.3/jquery.dataTables.min.js' type='text/javascript'></script>
8
- <script src='./assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js' type='text/javascript'></script>
9
- <script src='./assets/0.5.3/jquery.timeago.js' type='text/javascript'></script>
10
- <script src='./assets/0.5.3/jquery.url.js' type='text/javascript'></script>
11
- <script src='./assets/0.5.3/highlight.pack.js' type='text/javascript'></script>
12
- <script src='./assets/0.5.3/app.js' type='text/javascript'></script>
13
- <link href='./assets/0.5.3/stylesheet.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
14
- <link href='./assets/0.5.3/highlight.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
15
- <link href='./assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
16
- <link href='./assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
17
- <link rel="shortcut icon" type="image/png" href="./assets/0.5.3/favicon_yellow.png" />
18
- <link rel="icon" type="image/png" href="./assets/0.5.3/favicon.png" />
19
- </head>
20
-
21
- <body>
22
- <div id="loading">
23
- <img src="./assets/0.5.3/loading.gif" alt="loading"/>
24
- </div>
25
- <div id="wrapper" style="display:none;">
26
- <div class="timestamp">Generated <abbr class="timeago" title="2012-12-27T15:13:20-05:00">2012-12-27T15:13:20-05:00</abbr></div>
27
- <ul class="group_tabs"></ul>
28
-
29
- <div id="content">
30
- <div class="file_list_container" id="AllFiles">
31
- <h2>
32
- <span class="group_name">All Files</span>
33
- (<span class="covered_percent"><span class="yellow">82.3%</span></span>
34
- covered at
35
- <span class="covered_strength">
36
- <span class="green">
37
- 16.33
38
- </span>
39
- </span> hits/line)
40
- </h2>
41
- <a name="AllFiles"></a>
42
- <div>
43
- <b>7</b> files in total.
44
- <b>339</b> relevant lines.
45
- <span class="green"><b>279</b> lines covered</span> and
46
- <span class="red"><b>60</b> lines missed </span>
47
- </div>
48
- <table class="file_list">
49
- <thead>
50
- <tr>
51
- <th>File</th>
52
- <th>% covered</th>
53
- <th>Lines</th>
54
- <th>Relevant Lines</th>
55
- <th>Lines covered</th>
56
- <th>Lines missed</th>
57
- <th>Avg. Hits / Line</th>
58
- </tr>
59
- </thead>
60
- <tbody>
61
-
62
- <tr>
63
- <td class="strong"><a href="#23ece676ee554bd0a62670e8964fe96af2adc01a" class="src_link" title="lib/comparator.rb">lib/comparator.rb</a></td>
64
- <td class="green strong">96.08 %</td>
65
- <td>87</td>
66
- <td>51</td>
67
- <td>49</td>
68
- <td>2</td>
69
- <td>16.4</td>
70
- </tr>
71
-
72
- <tr>
73
- <td class="strong"><a href="#62f8063523b24e1e0397e524e8e048ddb0ac289c" class="src_link" title="lib/core_extensions.rb">lib/core_extensions.rb</a></td>
74
- <td class="yellow strong">88.24 %</td>
75
- <td>183</td>
76
- <td>85</td>
77
- <td>75</td>
78
- <td>10</td>
79
- <td>48.1</td>
80
- </tr>
81
-
82
- <tr>
83
- <td class="strong"><a href="#7ee6b0eb3c9dcde6be408d6b4f636325ec8416f6" class="src_link" title="lib/hash.rb">lib/hash.rb</a></td>
84
- <td class="green strong">93.75 %</td>
85
- <td>55</td>
86
- <td>32</td>
87
- <td>30</td>
88
- <td>2</td>
89
- <td>13.9</td>
90
- </tr>
91
-
92
- <tr>
93
- <td class="strong"><a href="#9082f1e417147c61ee326c565b15a99cad953b35" class="src_link" title="lib/hash_dealer.rb">lib/hash_dealer.rb</a></td>
94
- <td class="green strong">95.83 %</td>
95
- <td>97</td>
96
- <td>48</td>
97
- <td>46</td>
98
- <td>2</td>
99
- <td>22.7</td>
100
- </tr>
101
-
102
- <tr>
103
- <td class="strong"><a href="#4cc7721b735165eef9b1e5afd4a168c1a72d5103" class="src_link" title="lib/matcher.rb">lib/matcher.rb</a></td>
104
- <td class="red strong">48.84 %</td>
105
- <td>68</td>
106
- <td>43</td>
107
- <td>21</td>
108
- <td>22</td>
109
- <td>2.7</td>
110
- </tr>
111
-
112
- <tr>
113
- <td class="strong"><a href="#a262d63e5dc399019853b13f0e4b947eb9908f86" class="src_link" title="lib/path_string.rb">lib/path_string.rb</a></td>
114
- <td class="red strong">69.57 %</td>
115
- <td>125</td>
116
- <td>69</td>
117
- <td>48</td>
118
- <td>21</td>
119
- <td>6.4</td>
120
- </tr>
121
-
122
- <tr>
123
- <td class="strong"><a href="#a53828a5413df9e3a1d0192504eac81ee4166020" class="src_link" title="lib/variable_array.rb">lib/variable_array.rb</a></td>
124
- <td class="green strong">90.91 %</td>
125
- <td>18</td>
126
- <td>11</td>
127
- <td>10</td>
128
- <td>1</td>
129
- <td>4.1</td>
130
- </tr>
131
-
132
- </tbody>
133
- </table>
134
- </div>
135
-
136
-
137
-
138
- <div class="file_list_container" id="Controllers">
139
- <h2>
140
- <span class="group_name">Controllers</span>
141
- (<span class="covered_percent"><span class="green">100.0%</span></span>
142
- covered at
143
- <span class="covered_strength">
144
- <span class="red">
145
- 0.0
146
- </span>
147
- </span> hits/line)
148
- </h2>
149
- <a name="Controllers"></a>
150
- <div>
151
- <b>0</b> files in total.
152
- <b>0.0</b> relevant lines.
153
- <span class="green"><b>0.0</b> lines covered</span> and
154
- <span class="red"><b>0.0</b> lines missed </span>
155
- </div>
156
- <table class="file_list">
157
- <thead>
158
- <tr>
159
- <th>File</th>
160
- <th>% covered</th>
161
- <th>Lines</th>
162
- <th>Relevant Lines</th>
163
- <th>Lines covered</th>
164
- <th>Lines missed</th>
165
- <th>Avg. Hits / Line</th>
166
- </tr>
167
- </thead>
168
- <tbody>
169
-
170
- </tbody>
171
- </table>
172
- </div>
173
-
174
-
175
- <div class="file_list_container" id="Models">
176
- <h2>
177
- <span class="group_name">Models</span>
178
- (<span class="covered_percent"><span class="green">100.0%</span></span>
179
- covered at
180
- <span class="covered_strength">
181
- <span class="red">
182
- 0.0
183
- </span>
184
- </span> hits/line)
185
- </h2>
186
- <a name="Models"></a>
187
- <div>
188
- <b>0</b> files in total.
189
- <b>0.0</b> relevant lines.
190
- <span class="green"><b>0.0</b> lines covered</span> and
191
- <span class="red"><b>0.0</b> lines missed </span>
192
- </div>
193
- <table class="file_list">
194
- <thead>
195
- <tr>
196
- <th>File</th>
197
- <th>% covered</th>
198
- <th>Lines</th>
199
- <th>Relevant Lines</th>
200
- <th>Lines covered</th>
201
- <th>Lines missed</th>
202
- <th>Avg. Hits / Line</th>
203
- </tr>
204
- </thead>
205
- <tbody>
206
-
207
- </tbody>
208
- </table>
209
- </div>
210
-
211
-
212
- <div class="file_list_container" id="Mailers">
213
- <h2>
214
- <span class="group_name">Mailers</span>
215
- (<span class="covered_percent"><span class="green">100.0%</span></span>
216
- covered at
217
- <span class="covered_strength">
218
- <span class="red">
219
- 0.0
220
- </span>
221
- </span> hits/line)
222
- </h2>
223
- <a name="Mailers"></a>
224
- <div>
225
- <b>0</b> files in total.
226
- <b>0.0</b> relevant lines.
227
- <span class="green"><b>0.0</b> lines covered</span> and
228
- <span class="red"><b>0.0</b> lines missed </span>
229
- </div>
230
- <table class="file_list">
231
- <thead>
232
- <tr>
233
- <th>File</th>
234
- <th>% covered</th>
235
- <th>Lines</th>
236
- <th>Relevant Lines</th>
237
- <th>Lines covered</th>
238
- <th>Lines missed</th>
239
- <th>Avg. Hits / Line</th>
240
- </tr>
241
- </thead>
242
- <tbody>
243
-
244
- </tbody>
245
- </table>
246
- </div>
247
-
248
-
249
- <div class="file_list_container" id="Helpers">
250
- <h2>
251
- <span class="group_name">Helpers</span>
252
- (<span class="covered_percent"><span class="green">100.0%</span></span>
253
- covered at
254
- <span class="covered_strength">
255
- <span class="red">
256
- 0.0
257
- </span>
258
- </span> hits/line)
259
- </h2>
260
- <a name="Helpers"></a>
261
- <div>
262
- <b>0</b> files in total.
263
- <b>0.0</b> relevant lines.
264
- <span class="green"><b>0.0</b> lines covered</span> and
265
- <span class="red"><b>0.0</b> lines missed </span>
266
- </div>
267
- <table class="file_list">
268
- <thead>
269
- <tr>
270
- <th>File</th>
271
- <th>% covered</th>
272
- <th>Lines</th>
273
- <th>Relevant Lines</th>
274
- <th>Lines covered</th>
275
- <th>Lines missed</th>
276
- <th>Avg. Hits / Line</th>
277
- </tr>
278
- </thead>
279
- <tbody>
280
-
281
- </tbody>
282
- </table>
283
- </div>
284
-
285
-
286
- <div class="file_list_container" id="Libraries">
287
- <h2>
288
- <span class="group_name">Libraries</span>
289
- (<span class="covered_percent"><span class="yellow">82.3%</span></span>
290
- covered at
291
- <span class="covered_strength">
292
- <span class="green">
293
- 16.33
294
- </span>
295
- </span> hits/line)
296
- </h2>
297
- <a name="Libraries"></a>
298
- <div>
299
- <b>7</b> files in total.
300
- <b>339</b> relevant lines.
301
- <span class="green"><b>279</b> lines covered</span> and
302
- <span class="red"><b>60</b> lines missed </span>
303
- </div>
304
- <table class="file_list">
305
- <thead>
306
- <tr>
307
- <th>File</th>
308
- <th>% covered</th>
309
- <th>Lines</th>
310
- <th>Relevant Lines</th>
311
- <th>Lines covered</th>
312
- <th>Lines missed</th>
313
- <th>Avg. Hits / Line</th>
314
- </tr>
315
- </thead>
316
- <tbody>
317
-
318
- <tr>
319
- <td class="strong"><a href="#23ece676ee554bd0a62670e8964fe96af2adc01a" class="src_link" title="lib/comparator.rb">lib/comparator.rb</a></td>
320
- <td class="green strong">96.08 %</td>
321
- <td>87</td>
322
- <td>51</td>
323
- <td>49</td>
324
- <td>2</td>
325
- <td>16.4</td>
326
- </tr>
327
-
328
- <tr>
329
- <td class="strong"><a href="#62f8063523b24e1e0397e524e8e048ddb0ac289c" class="src_link" title="lib/core_extensions.rb">lib/core_extensions.rb</a></td>
330
- <td class="yellow strong">88.24 %</td>
331
- <td>183</td>
332
- <td>85</td>
333
- <td>75</td>
334
- <td>10</td>
335
- <td>48.1</td>
336
- </tr>
337
-
338
- <tr>
339
- <td class="strong"><a href="#7ee6b0eb3c9dcde6be408d6b4f636325ec8416f6" class="src_link" title="lib/hash.rb">lib/hash.rb</a></td>
340
- <td class="green strong">93.75 %</td>
341
- <td>55</td>
342
- <td>32</td>
343
- <td>30</td>
344
- <td>2</td>
345
- <td>13.9</td>
346
- </tr>
347
-
348
- <tr>
349
- <td class="strong"><a href="#9082f1e417147c61ee326c565b15a99cad953b35" class="src_link" title="lib/hash_dealer.rb">lib/hash_dealer.rb</a></td>
350
- <td class="green strong">95.83 %</td>
351
- <td>97</td>
352
- <td>48</td>
353
- <td>46</td>
354
- <td>2</td>
355
- <td>22.7</td>
356
- </tr>
357
-
358
- <tr>
359
- <td class="strong"><a href="#4cc7721b735165eef9b1e5afd4a168c1a72d5103" class="src_link" title="lib/matcher.rb">lib/matcher.rb</a></td>
360
- <td class="red strong">48.84 %</td>
361
- <td>68</td>
362
- <td>43</td>
363
- <td>21</td>
364
- <td>22</td>
365
- <td>2.7</td>
366
- </tr>
367
-
368
- <tr>
369
- <td class="strong"><a href="#a262d63e5dc399019853b13f0e4b947eb9908f86" class="src_link" title="lib/path_string.rb">lib/path_string.rb</a></td>
370
- <td class="red strong">69.57 %</td>
371
- <td>125</td>
372
- <td>69</td>
373
- <td>48</td>
374
- <td>21</td>
375
- <td>6.4</td>
376
- </tr>
377
-
378
- <tr>
379
- <td class="strong"><a href="#a53828a5413df9e3a1d0192504eac81ee4166020" class="src_link" title="lib/variable_array.rb">lib/variable_array.rb</a></td>
380
- <td class="green strong">90.91 %</td>
381
- <td>18</td>
382
- <td>11</td>
383
- <td>10</td>
384
- <td>1</td>
385
- <td>4.1</td>
386
- </tr>
387
-
388
- </tbody>
389
- </table>
390
- </div>
391
-
392
-
393
- <div class="file_list_container" id="Plugins">
394
- <h2>
395
- <span class="group_name">Plugins</span>
396
- (<span class="covered_percent"><span class="green">100.0%</span></span>
397
- covered at
398
- <span class="covered_strength">
399
- <span class="red">
400
- 0.0
401
- </span>
402
- </span> hits/line)
403
- </h2>
404
- <a name="Plugins"></a>
405
- <div>
406
- <b>0</b> files in total.
407
- <b>0.0</b> relevant lines.
408
- <span class="green"><b>0.0</b> lines covered</span> and
409
- <span class="red"><b>0.0</b> lines missed </span>
410
- </div>
411
- <table class="file_list">
412
- <thead>
413
- <tr>
414
- <th>File</th>
415
- <th>% covered</th>
416
- <th>Lines</th>
417
- <th>Relevant Lines</th>
418
- <th>Lines covered</th>
419
- <th>Lines missed</th>
420
- <th>Avg. Hits / Line</th>
421
- </tr>
422
- </thead>
423
- <tbody>
424
-
425
- </tbody>
426
- </table>
427
- </div>
428
-
429
-
430
- </div>
431
-
432
- <div id="footer">
433
- Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.5.4
434
- and simplecov-html v0.5.3<br/>
435
- using RSpec
436
- </div>
437
-
438
- <div class="source_files">
439
-
440
- <div class="source_table" id="23ece676ee554bd0a62670e8964fe96af2adc01a">
441
- <div class="header">
442
- <h3>lib/comparator.rb</h3>
443
- <h4><span class="green">96.08 %</span> covered</h4>
444
- <div>
445
- <b>51</b> relevant lines.
446
- <span class="green"><b>49</b> lines covered</span> and
447
- <span class="red"><b>2</b> lines missed.</span>
448
- </div>
449
- </div>
450
-
451
- <pre>
452
- <ol>
453
-
454
- <li class="covered" data-hits="1" data-linenumber="1">
455
- <span class="hits">1</span>
456
-
457
- <code class="ruby">require 'active_support/core_ext'</code>
458
- </li>
459
-
460
- <li class="never" data-hits="" data-linenumber="2">
461
-
462
-
463
- <code class="ruby"></code>
464
- </li>
465
-
466
- <li class="covered" data-hits="1" data-linenumber="3">
467
- <span class="hits">1</span>
468
-
469
- <code class="ruby">class Comparator</code>
470
- </li>
471
-
472
- <li class="never" data-hits="" data-linenumber="4">
473
-
474
-
475
- <code class="ruby"> </code>
476
- </li>
477
-
478
- <li class="covered" data-hits="1" data-linenumber="5">
479
- <span class="hits">1</span>
480
-
481
- <code class="ruby"> def self.formatted_value(val)</code>
482
- </li>
483
-
484
- <li class="covered" data-hits="9" data-linenumber="6">
485
- <span class="hits">9</span>
486
-
487
- <code class="ruby"> if val.nil?</code>
488
- </li>
489
-
490
- <li class="missed" data-hits="0" data-linenumber="7">
491
-
492
-
493
- <code class="ruby"> return &quot;NilClass::nil&quot;</code>
494
- </li>
495
-
496
- <li class="covered" data-hits="9" data-linenumber="8">
497
- <span class="hits">9</span>
498
-
499
- <code class="ruby"> elsif val.is_a?(PathString)</code>
500
- </li>
501
-
502
- <li class="covered" data-hits="2" data-linenumber="9">
503
- <span class="hits">2</span>
504
-
505
- <code class="ruby"> return val.gsub(&quot;:&quot;,&quot;&quot;)</code>
506
- </li>
507
-
508
- <li class="covered" data-hits="7" data-linenumber="10">
509
- <span class="hits">7</span>
510
-
511
- <code class="ruby"> elsif val == &quot;&quot;</code>
512
- </li>
513
-
514
- <li class="missed" data-hits="0" data-linenumber="11">
515
-
516
-
517
- <code class="ruby"> return &quot;''&quot;</code>
518
- </li>
519
-
520
- <li class="never" data-hits="" data-linenumber="12">
521
-
522
-
523
- <code class="ruby"> else</code>
524
- </li>
525
-
526
- <li class="covered" data-hits="7" data-linenumber="13">
527
- <span class="hits">7</span>
528
-
529
- <code class="ruby"> return val</code>
530
- </li>
531
-
532
- <li class="never" data-hits="" data-linenumber="14">
533
-
534
-
535
- <code class="ruby"> end</code>
536
- </li>
537
-
538
- <li class="never" data-hits="" data-linenumber="15">
539
-
540
-
541
- <code class="ruby"> end</code>
542
- </li>
543
-
544
- <li class="never" data-hits="" data-linenumber="16">
545
-
546
-
547
- <code class="ruby"> </code>
548
- </li>
549
-
550
- <li class="covered" data-hits="1" data-linenumber="17">
551
- <span class="hits">1</span>
552
-
553
- <code class="ruby"> def self.normalize_value(val)</code>
554
- </li>
555
-
556
- <li class="covered" data-hits="35" data-linenumber="18">
557
- <span class="hits">35</span>
558
-
559
- <code class="ruby"> return val if val.is_a?(TimeDateMatcher)</code>
560
- </li>
561
-
562
- <li class="covered" data-hits="35" data-linenumber="19">
563
- <span class="hits">35</span>
564
-
565
- <code class="ruby"> val = ActiveSupport::JSON.decode(val) if val.is_a?(String)</code>
566
- </li>
567
-
568
- <li class="covered" data-hits="35" data-linenumber="20">
569
- <span class="hits">35</span>
570
-
571
- <code class="ruby"> val = self.stringify_keys(val) if val.is_a?(Hash)</code>
572
- </li>
573
-
574
- <li class="never" data-hits="" data-linenumber="21">
575
-
576
-
577
- <code class="ruby"> </code>
578
- </li>
579
-
580
- <li class="covered" data-hits="35" data-linenumber="22">
581
- <span class="hits">35</span>
582
-
583
- <code class="ruby"> if val.is_a?(Array)</code>
584
- </li>
585
-
586
- <li class="covered" data-hits="2" data-linenumber="23">
587
- <span class="hits">2</span>
588
-
589
- <code class="ruby"> val = val.collect{|v| </code>
590
- </li>
591
-
592
- <li class="covered" data-hits="4" data-linenumber="24">
593
- <span class="hits">4</span>
594
-
595
- <code class="ruby"> v.is_a?(Hash) || v.is_a?(Array) ? self.normalize_value(v) : v</code>
596
- </li>
597
-
598
- <li class="never" data-hits="" data-linenumber="25">
599
-
600
-
601
- <code class="ruby"> }</code>
602
- </li>
603
-
604
- <li class="never" data-hits="" data-linenumber="26">
605
-
606
-
607
- <code class="ruby"> end</code>
608
- </li>
609
-
610
- <li class="never" data-hits="" data-linenumber="27">
611
-
612
-
613
- <code class="ruby"></code>
614
- </li>
615
-
616
- <li class="covered" data-hits="35" data-linenumber="28">
617
- <span class="hits">35</span>
618
-
619
- <code class="ruby"> val</code>
620
- </li>
621
-
622
- <li class="never" data-hits="" data-linenumber="29">
623
-
624
-
625
- <code class="ruby"> end</code>
626
- </li>
627
-
628
- <li class="never" data-hits="" data-linenumber="30">
629
-
630
-
631
- <code class="ruby"> </code>
632
- </li>
633
-
634
- <li class="covered" data-hits="1" data-linenumber="31">
635
- <span class="hits">1</span>
636
-
637
- <code class="ruby"> def self.diff(obj1, obj2)</code>
638
- </li>
639
-
640
- <li class="covered" data-hits="29" data-linenumber="32">
641
- <span class="hits">29</span>
642
-
643
- <code class="ruby"> return {} if obj1.eql?(obj2)</code>
644
- </li>
645
-
646
- <li class="covered" data-hits="13" data-linenumber="33">
647
- <span class="hits">13</span>
648
-
649
- <code class="ruby"> if obj1.is_a?(Array) &amp;&amp; obj2.is_a?(Array)</code>
650
- </li>
651
-
652
- <li class="covered" data-hits="1" data-linenumber="34">
653
- <span class="hits">1</span>
654
-
655
- <code class="ruby"> return self.array_diff(obj1, obj2) </code>
656
- </li>
657
-
658
- <li class="never" data-hits="" data-linenumber="35">
659
-
660
-
661
- <code class="ruby"> elsif obj1.is_a?(Hash) &amp;&amp; obj2.is_a?(Hash)</code>
662
- </li>
663
-
664
- <li class="covered" data-hits="11" data-linenumber="36">
665
- <span class="hits">11</span>
666
-
667
- <code class="ruby"> return self.hash_diff(obj1, obj2) </code>
668
- </li>
669
-
670
- <li class="never" data-hits="" data-linenumber="37">
671
-
672
-
673
- <code class="ruby"> end</code>
674
- </li>
675
-
676
- <li class="covered" data-hits="1" data-linenumber="38">
677
- <span class="hits">1</span>
678
-
679
- <code class="ruby"> return [formatted_value(obj1), &quot;KEY MISSING&quot;] if obj2.nil?</code>
680
- </li>
681
-
682
- <li class="covered" data-hits="1" data-linenumber="39">
683
- <span class="hits">1</span>
684
-
685
- <code class="ruby"> return [&quot;KEY MISSING&quot;, formatted_value(obj2)] if obj1.nil?</code>
686
- </li>
687
-
688
- <li class="covered" data-hits="1" data-linenumber="40">
689
- <span class="hits">1</span>
690
-
691
- <code class="ruby"> return [formatted_value(obj1), formatted_value(obj2)]</code>
692
- </li>
693
-
694
- <li class="never" data-hits="" data-linenumber="41">
695
-
696
-
697
- <code class="ruby"> end</code>
698
- </li>
699
-
700
- <li class="never" data-hits="" data-linenumber="42">
701
-
702
-
703
- <code class="ruby"> </code>
704
- </li>
705
-
706
- <li class="covered" data-hits="1" data-linenumber="43">
707
- <span class="hits">1</span>
708
-
709
- <code class="ruby"> def self.array_diff(obj1, obj2)</code>
710
- </li>
711
-
712
- <li class="covered" data-hits="1" data-linenumber="44">
713
- <span class="hits">1</span>
714
-
715
- <code class="ruby"> {}.tap do |ret|</code>
716
- </li>
717
-
718
- <li class="never" data-hits="" data-linenumber="45">
719
-
720
-
721
- <code class="ruby"> # handle VariableArray by extracting the first element</code>
722
- </li>
723
-
724
- <li class="never" data-hits="" data-linenumber="46">
725
-
726
-
727
- <code class="ruby"> # of non-VariableArrays and the 2nd element of VariableArrays</code>
728
- </li>
729
-
730
- <li class="covered" data-hits="1" data-linenumber="47">
731
- <span class="hits">1</span>
732
-
733
- <code class="ruby"> if obj1.is_a?(VariableArray) || obj2.is_a?(VariableArray)</code>
734
- </li>
735
-
736
- <li class="covered" data-hits="1" data-linenumber="48">
737
- <span class="hits">1</span>
738
-
739
- <code class="ruby"> obj1 = obj1.is_a?(VariableArray) ? [obj1[1]] : [obj1[0]]</code>
740
- </li>
741
-
742
- <li class="covered" data-hits="1" data-linenumber="49">
743
- <span class="hits">1</span>
744
-
745
- <code class="ruby"> obj2 = obj2.is_a?(VariableArray) ? [obj2[1]] : [obj2[0]]</code>
746
- </li>
747
-
748
- <li class="never" data-hits="" data-linenumber="50">
749
-
750
-
751
- <code class="ruby"> end</code>
752
- </li>
753
-
754
- <li class="covered" data-hits="1" data-linenumber="51">
755
- <span class="hits">1</span>
756
-
757
- <code class="ruby"> bigger_arr = obj1.size &gt;= obj2.size ? obj1 : obj2</code>
758
- </li>
759
-
760
- <li class="covered" data-hits="1" data-linenumber="52">
761
- <span class="hits">1</span>
762
-
763
- <code class="ruby"> bigger_arr.each_index do |k|</code>
764
- </li>
765
-
766
- <li class="covered" data-hits="1" data-linenumber="53">
767
- <span class="hits">1</span>
768
-
769
- <code class="ruby"> ret[k] = self.diff(obj1[k], obj2[k]) unless obj1[k] == obj2[k]</code>
770
- </li>
771
-
772
- <li class="never" data-hits="" data-linenumber="54">
773
-
774
-
775
- <code class="ruby"> end </code>
776
- </li>
777
-
778
- <li class="never" data-hits="" data-linenumber="55">
779
-
780
-
781
- <code class="ruby"> end</code>
782
- </li>
783
-
784
- <li class="never" data-hits="" data-linenumber="56">
785
-
786
-
787
- <code class="ruby"> end</code>
788
- </li>
789
-
790
- <li class="never" data-hits="" data-linenumber="57">
791
-
792
-
793
- <code class="ruby"> </code>
794
- </li>
795
-
796
- <li class="covered" data-hits="1" data-linenumber="58">
797
- <span class="hits">1</span>
798
-
799
- <code class="ruby"> def self.hash_diff(obj1, obj2)</code>
800
- </li>
801
-
802
- <li class="covered" data-hits="11" data-linenumber="59">
803
- <span class="hits">11</span>
804
-
805
- <code class="ruby"> obj1, obj2 = self.stringify_keys(obj1), self.stringify_keys(obj2)</code>
806
- </li>
807
-
808
- <li class="covered" data-hits="11" data-linenumber="60">
809
- <span class="hits">11</span>
810
-
811
- <code class="ruby"> (obj1.keys + obj2.keys).uniq.inject({}) do |memo, key|</code>
812
- </li>
813
-
814
- <li class="covered" data-hits="19" data-linenumber="61">
815
- <span class="hits">19</span>
816
-
817
- <code class="ruby"> if !obj1.keys.include?(key) </code>
818
- </li>
819
-
820
- <li class="covered" data-hits="3" data-linenumber="62">
821
- <span class="hits">3</span>
822
-
823
- <code class="ruby"> memo[key] = [&quot;KEY MISSING&quot;, formatted_value(obj2[key])]</code>
824
- </li>
825
-
826
- <li class="never" data-hits="" data-linenumber="63">
827
-
828
-
829
- <code class="ruby"> elsif !obj2.keys.include?(key) </code>
830
- </li>
831
-
832
- <li class="covered" data-hits="4" data-linenumber="64">
833
- <span class="hits">4</span>
834
-
835
- <code class="ruby"> memo[key] = [formatted_value(obj1[key]), &quot;KEY MISSING&quot;]</code>
836
- </li>
837
-
838
- <li class="never" data-hits="" data-linenumber="65">
839
-
840
-
841
- <code class="ruby"> elsif obj1[key] != obj2[key]</code>
842
- </li>
843
-
844
- <li class="covered" data-hits="3" data-linenumber="66">
845
- <span class="hits">3</span>
846
-
847
- <code class="ruby"> memo[key] = self.diff(obj1[key], obj2[key])</code>
848
- </li>
849
-
850
- <li class="never" data-hits="" data-linenumber="67">
851
-
852
-
853
- <code class="ruby"> end</code>
854
- </li>
855
-
856
- <li class="covered" data-hits="19" data-linenumber="68">
857
- <span class="hits">19</span>
858
-
859
- <code class="ruby"> memo</code>
860
- </li>
861
-
862
- <li class="never" data-hits="" data-linenumber="69">
863
-
864
-
865
- <code class="ruby"> end</code>
866
- </li>
867
-
868
- <li class="never" data-hits="" data-linenumber="70">
869
-
870
-
871
- <code class="ruby"> end</code>
872
- </li>
873
-
874
- <li class="never" data-hits="" data-linenumber="71">
875
-
876
-
877
- <code class="ruby"> </code>
878
- </li>
879
-
880
- <li class="covered" data-hits="1" data-linenumber="72">
881
- <span class="hits">1</span>
882
-
883
- <code class="ruby"> def self.stringify_keys(hash_or_array)</code>
884
- </li>
885
-
886
- <li class="covered" data-hits="88" data-linenumber="73">
887
- <span class="hits">88</span>
888
-
889
- <code class="ruby"> if hash_or_array.is_a?(Array)</code>
890
- </li>
891
-
892
- <li class="never" data-hits="" data-linenumber="74">
893
-
894
-
895
- <code class="ruby"> return hash_or_array.collect{|v| </code>
896
- </li>
897
-
898
- <li class="covered" data-hits="27" data-linenumber="75">
899
- <span class="hits">27</span>
900
-
901
- <code class="ruby"> v.is_a?(Hash) || v.is_a?(Array) ? self.stringify_keys(v) : v</code>
902
- </li>
903
-
904
- <li class="covered" data-hits="12" data-linenumber="76">
905
- <span class="hits">12</span>
906
-
907
- <code class="ruby"> }</code>
908
- </li>
909
-
910
- <li class="never" data-hits="" data-linenumber="77">
911
-
912
-
913
- <code class="ruby"> end</code>
914
- </li>
915
-
916
- <li class="never" data-hits="" data-linenumber="78">
917
-
918
-
919
- <code class="ruby"> </code>
920
- </li>
921
-
922
- <li class="covered" data-hits="76" data-linenumber="79">
923
- <span class="hits">76</span>
924
-
925
- <code class="ruby"> ret = hash_or_array.stringify_keys</code>
926
- </li>
927
-
928
- <li class="covered" data-hits="76" data-linenumber="80">
929
- <span class="hits">76</span>
930
-
931
- <code class="ruby"> ret.each_pair do |k,v|</code>
932
- </li>
933
-
934
- <li class="covered" data-hits="101" data-linenumber="81">
935
- <span class="hits">101</span>
936
-
937
- <code class="ruby"> if v.is_a?(Hash) || v.is_a?(Array)</code>
938
- </li>
939
-
940
- <li class="covered" data-hits="21" data-linenumber="82">
941
- <span class="hits">21</span>
942
-
943
- <code class="ruby"> ret[k] = self.stringify_keys(v)</code>
944
- </li>
945
-
946
- <li class="never" data-hits="" data-linenumber="83">
947
-
948
-
949
- <code class="ruby"> end</code>
950
- </li>
951
-
952
- <li class="never" data-hits="" data-linenumber="84">
953
-
954
-
955
- <code class="ruby"> end</code>
956
- </li>
957
-
958
- <li class="covered" data-hits="76" data-linenumber="85">
959
- <span class="hits">76</span>
960
-
961
- <code class="ruby"> ret</code>
962
- </li>
963
-
964
- <li class="never" data-hits="" data-linenumber="86">
965
-
966
-
967
- <code class="ruby"> end</code>
968
- </li>
969
-
970
- <li class="never" data-hits="" data-linenumber="87">
971
-
972
-
973
- <code class="ruby">end</code>
974
- </li>
975
-
976
- </ol>
977
- </pre>
978
- </div>
979
-
980
- <div class="source_table" id="62f8063523b24e1e0397e524e8e048ddb0ac289c">
981
- <div class="header">
982
- <h3>lib/core_extensions.rb</h3>
983
- <h4><span class="yellow">88.24 %</span> covered</h4>
984
- <div>
985
- <b>85</b> relevant lines.
986
- <span class="green"><b>75</b> lines covered</span> and
987
- <span class="red"><b>10</b> lines missed.</span>
988
- </div>
989
- </div>
990
-
991
- <pre>
992
- <ol>
993
-
994
- <li class="covered" data-hits="1" data-linenumber="1">
995
- <span class="hits">1</span>
996
-
997
- <code class="ruby">class Object</code>
998
- </li>
999
-
1000
- <li class="never" data-hits="" data-linenumber="2">
1001
-
1002
-
1003
- <code class="ruby"> # allows us to call matcher blindly</code>
1004
- </li>
1005
-
1006
- <li class="covered" data-hits="1" data-linenumber="3">
1007
- <span class="hits">1</span>
1008
-
1009
- <code class="ruby"> def matcher(opts = {})</code>
1010
- </li>
1011
-
1012
- <li class="missed" data-hits="0" data-linenumber="4">
1013
-
1014
-
1015
- <code class="ruby"> return self</code>
1016
- </li>
1017
-
1018
- <li class="never" data-hits="" data-linenumber="5">
1019
-
1020
-
1021
- <code class="ruby"> end</code>
1022
- </li>
1023
-
1024
- <li class="never" data-hits="" data-linenumber="6">
1025
-
1026
-
1027
- <code class="ruby">end</code>
1028
- </li>
1029
-
1030
- <li class="never" data-hits="" data-linenumber="7">
1031
-
1032
-
1033
- <code class="ruby"></code>
1034
- </li>
1035
-
1036
- <li class="covered" data-hits="1" data-linenumber="8">
1037
- <span class="hits">1</span>
1038
-
1039
- <code class="ruby">class TimeDateMatcher</code>
1040
- </li>
1041
-
1042
- <li class="covered" data-hits="1" data-linenumber="9">
1043
- <span class="hits">1</span>
1044
-
1045
- <code class="ruby"> attr_reader :instance</code>
1046
- </li>
1047
-
1048
- <li class="covered" data-hits="1" data-linenumber="10">
1049
- <span class="hits">1</span>
1050
-
1051
- <code class="ruby"> def initialize(instance)</code>
1052
- </li>
1053
-
1054
- <li class="covered" data-hits="8" data-linenumber="11">
1055
- <span class="hits">8</span>
1056
-
1057
- <code class="ruby"> @instance = instance</code>
1058
- </li>
1059
-
1060
- <li class="never" data-hits="" data-linenumber="12">
1061
-
1062
-
1063
- <code class="ruby"> end</code>
1064
- </li>
1065
-
1066
- <li class="covered" data-hits="1" data-linenumber="13">
1067
- <span class="hits">1</span>
1068
-
1069
- <code class="ruby"> def ==(other)</code>
1070
- </li>
1071
-
1072
- <li class="never" data-hits="" data-linenumber="14">
1073
-
1074
-
1075
- <code class="ruby"> # allow nils to match</code>
1076
- </li>
1077
-
1078
- <li class="covered" data-hits="12" data-linenumber="15">
1079
- <span class="hits">12</span>
1080
-
1081
- <code class="ruby"> return true if other.nil?</code>
1082
- </li>
1083
-
1084
- <li class="never" data-hits="" data-linenumber="16">
1085
-
1086
-
1087
- <code class="ruby"> # attempt to parse any strings</code>
1088
- </li>
1089
-
1090
- <li class="covered" data-hits="10" data-linenumber="17">
1091
- <span class="hits">10</span>
1092
-
1093
- <code class="ruby"> if other.is_a?(String)</code>
1094
- </li>
1095
-
1096
- <li class="covered" data-hits="2" data-linenumber="18">
1097
- <span class="hits">2</span>
1098
-
1099
- <code class="ruby"> begin</code>
1100
- </li>
1101
-
1102
- <li class="covered" data-hits="2" data-linenumber="19">
1103
- <span class="hits">2</span>
1104
-
1105
- <code class="ruby"> other = self.instance.class.parse(other)</code>
1106
- </li>
1107
-
1108
- <li class="never" data-hits="" data-linenumber="20">
1109
-
1110
-
1111
- <code class="ruby"> rescue =&gt; e</code>
1112
- </li>
1113
-
1114
- <li class="missed" data-hits="0" data-linenumber="21">
1115
-
1116
-
1117
- <code class="ruby"> return false</code>
1118
- </li>
1119
-
1120
- <li class="never" data-hits="" data-linenumber="22">
1121
-
1122
-
1123
- <code class="ruby"> end</code>
1124
- </li>
1125
-
1126
- <li class="never" data-hits="" data-linenumber="23">
1127
-
1128
-
1129
- <code class="ruby"> end</code>
1130
- </li>
1131
-
1132
- <li class="covered" data-hits="10" data-linenumber="24">
1133
- <span class="hits">10</span>
1134
-
1135
- <code class="ruby"> self.instance.class == other.class</code>
1136
- </li>
1137
-
1138
- <li class="never" data-hits="" data-linenumber="25">
1139
-
1140
-
1141
- <code class="ruby"> end</code>
1142
- </li>
1143
-
1144
- <li class="covered" data-hits="1" data-linenumber="26">
1145
- <span class="hits">1</span>
1146
-
1147
- <code class="ruby"> alias_method :eql?, :==</code>
1148
- </li>
1149
-
1150
- <li class="never" data-hits="" data-linenumber="27">
1151
-
1152
-
1153
- <code class="ruby">end</code>
1154
- </li>
1155
-
1156
- <li class="never" data-hits="" data-linenumber="28">
1157
-
1158
-
1159
- <code class="ruby"></code>
1160
- </li>
1161
-
1162
- <li class="never" data-hits="" data-linenumber="29">
1163
-
1164
-
1165
- <code class="ruby"># including a module didn't work here - not sure why though</code>
1166
- </li>
1167
-
1168
- <li class="covered" data-hits="1" data-linenumber="30">
1169
- <span class="hits">1</span>
1170
-
1171
- <code class="ruby">[Time, DateTime, Date].each do |klass|</code>
1172
- </li>
1173
-
1174
- <li class="covered" data-hits="3" data-linenumber="31">
1175
- <span class="hits">3</span>
1176
-
1177
- <code class="ruby"> klass.class_eval &lt;&lt;-EOE, __FILE__, __LINE__ + 1</code>
1178
- </li>
1179
-
1180
- <li class="never" data-hits="" data-linenumber="32">
1181
-
1182
-
1183
- <code class="ruby"> def matcher(opts = {})</code>
1184
- </li>
1185
-
1186
- <li class="never" data-hits="" data-linenumber="33">
1187
-
1188
-
1189
- <code class="ruby"> TimeDateMatcher.new(self)</code>
1190
- </li>
1191
-
1192
- <li class="never" data-hits="" data-linenumber="34">
1193
-
1194
-
1195
- <code class="ruby"> end</code>
1196
- </li>
1197
-
1198
- <li class="never" data-hits="" data-linenumber="35">
1199
-
1200
-
1201
- <code class="ruby"></code>
1202
- </li>
1203
-
1204
- <li class="never" data-hits="" data-linenumber="36">
1205
-
1206
-
1207
- <code class="ruby"> alias_method :old_eql?, :eql?</code>
1208
- </li>
1209
-
1210
- <li class="never" data-hits="" data-linenumber="37">
1211
-
1212
-
1213
- <code class="ruby"> alias_method :old_equals_equals, :==</code>
1214
- </li>
1215
-
1216
- <li class="never" data-hits="" data-linenumber="38">
1217
-
1218
-
1219
- <code class="ruby"></code>
1220
- </li>
1221
-
1222
- <li class="never" data-hits="" data-linenumber="39">
1223
-
1224
-
1225
- <code class="ruby"> def ==(other)</code>
1226
- </li>
1227
-
1228
- <li class="never" data-hits="" data-linenumber="40">
1229
-
1230
-
1231
- <code class="ruby"> return other == self if other.is_a?(TimeDateMatcher)</code>
1232
- </li>
1233
-
1234
- <li class="never" data-hits="" data-linenumber="41">
1235
-
1236
-
1237
- <code class="ruby"> return old_equals_equals(other)</code>
1238
- </li>
1239
-
1240
- <li class="never" data-hits="" data-linenumber="42">
1241
-
1242
-
1243
- <code class="ruby"> end</code>
1244
- </li>
1245
-
1246
- <li class="never" data-hits="" data-linenumber="43">
1247
-
1248
-
1249
- <code class="ruby"></code>
1250
- </li>
1251
-
1252
- <li class="never" data-hits="" data-linenumber="44">
1253
-
1254
-
1255
- <code class="ruby"> def eql?(other)</code>
1256
- </li>
1257
-
1258
- <li class="never" data-hits="" data-linenumber="45">
1259
-
1260
-
1261
- <code class="ruby"> return other.eql?(self) if other.is_a?(TimeDateMatcher)</code>
1262
- </li>
1263
-
1264
- <li class="never" data-hits="" data-linenumber="46">
1265
-
1266
-
1267
- <code class="ruby"> return old_eql?(other)</code>
1268
- </li>
1269
-
1270
- <li class="never" data-hits="" data-linenumber="47">
1271
-
1272
-
1273
- <code class="ruby"> end</code>
1274
- </li>
1275
-
1276
- <li class="never" data-hits="" data-linenumber="48">
1277
-
1278
-
1279
- <code class="ruby"> </code>
1280
- </li>
1281
-
1282
- <li class="never" data-hits="" data-linenumber="49">
1283
-
1284
-
1285
- <code class="ruby"> EOE</code>
1286
- </li>
1287
-
1288
- <li class="never" data-hits="" data-linenumber="50">
1289
-
1290
-
1291
- <code class="ruby">end</code>
1292
- </li>
1293
-
1294
- <li class="never" data-hits="" data-linenumber="51">
1295
-
1296
-
1297
- <code class="ruby"></code>
1298
- </li>
1299
-
1300
- <li class="covered" data-hits="1" data-linenumber="52">
1301
- <span class="hits">1</span>
1302
-
1303
- <code class="ruby">class BooleanMatcher</code>
1304
- </li>
1305
-
1306
- <li class="covered" data-hits="1" data-linenumber="53">
1307
- <span class="hits">1</span>
1308
-
1309
- <code class="ruby"> attr_reader :instance</code>
1310
- </li>
1311
-
1312
- <li class="covered" data-hits="1" data-linenumber="54">
1313
- <span class="hits">1</span>
1314
-
1315
- <code class="ruby"> def initialize(instance)</code>
1316
- </li>
1317
-
1318
- <li class="covered" data-hits="2" data-linenumber="55">
1319
- <span class="hits">2</span>
1320
-
1321
- <code class="ruby"> @instance = instance</code>
1322
- </li>
1323
-
1324
- <li class="never" data-hits="" data-linenumber="56">
1325
-
1326
-
1327
- <code class="ruby"> end</code>
1328
- </li>
1329
-
1330
- <li class="covered" data-hits="1" data-linenumber="57">
1331
- <span class="hits">1</span>
1332
-
1333
- <code class="ruby"> def ==(other)</code>
1334
- </li>
1335
-
1336
- <li class="covered" data-hits="2" data-linenumber="58">
1337
- <span class="hits">2</span>
1338
-
1339
- <code class="ruby"> return (other.is_a?(TrueClass) || other.is_a?(FalseClass) || other.is_a?(BooleanMatcher))</code>
1340
- </li>
1341
-
1342
- <li class="never" data-hits="" data-linenumber="59">
1343
-
1344
-
1345
- <code class="ruby"> end</code>
1346
- </li>
1347
-
1348
- <li class="covered" data-hits="1" data-linenumber="60">
1349
- <span class="hits">1</span>
1350
-
1351
- <code class="ruby"> alias_method :eql?, :==</code>
1352
- </li>
1353
-
1354
- <li class="never" data-hits="" data-linenumber="61">
1355
-
1356
-
1357
- <code class="ruby">end</code>
1358
- </li>
1359
-
1360
- <li class="never" data-hits="" data-linenumber="62">
1361
-
1362
-
1363
- <code class="ruby"></code>
1364
- </li>
1365
-
1366
- <li class="covered" data-hits="1" data-linenumber="63">
1367
- <span class="hits">1</span>
1368
-
1369
- <code class="ruby">[TrueClass, FalseClass].each do |klass|</code>
1370
- </li>
1371
-
1372
- <li class="covered" data-hits="2" data-linenumber="64">
1373
- <span class="hits">2</span>
1374
-
1375
- <code class="ruby"> klass.class_eval &lt;&lt;-EOE, __FILE__, __LINE__ +1</code>
1376
- </li>
1377
-
1378
- <li class="never" data-hits="" data-linenumber="65">
1379
-
1380
-
1381
- <code class="ruby"> def matcher(opts={})</code>
1382
- </li>
1383
-
1384
- <li class="never" data-hits="" data-linenumber="66">
1385
-
1386
-
1387
- <code class="ruby"> BooleanMatcher.new(self)</code>
1388
- </li>
1389
-
1390
- <li class="never" data-hits="" data-linenumber="67">
1391
-
1392
-
1393
- <code class="ruby"> end</code>
1394
- </li>
1395
-
1396
- <li class="never" data-hits="" data-linenumber="68">
1397
-
1398
-
1399
- <code class="ruby"> </code>
1400
- </li>
1401
-
1402
- <li class="never" data-hits="" data-linenumber="69">
1403
-
1404
-
1405
- <code class="ruby"> alias_method :old_eql?, :eql?</code>
1406
- </li>
1407
-
1408
- <li class="never" data-hits="" data-linenumber="70">
1409
-
1410
-
1411
- <code class="ruby"> alias_method :old_equals_equals, :==</code>
1412
- </li>
1413
-
1414
- <li class="never" data-hits="" data-linenumber="71">
1415
-
1416
-
1417
- <code class="ruby"> </code>
1418
- </li>
1419
-
1420
- <li class="never" data-hits="" data-linenumber="72">
1421
-
1422
-
1423
- <code class="ruby"> def ==(other)</code>
1424
- </li>
1425
-
1426
- <li class="never" data-hits="" data-linenumber="73">
1427
-
1428
-
1429
- <code class="ruby"> return other == self if other.is_a?(BooleanMatcher)</code>
1430
- </li>
1431
-
1432
- <li class="never" data-hits="" data-linenumber="74">
1433
-
1434
-
1435
- <code class="ruby"> return self.old_equals_equals(other)</code>
1436
- </li>
1437
-
1438
- <li class="never" data-hits="" data-linenumber="75">
1439
-
1440
-
1441
- <code class="ruby"> end</code>
1442
- </li>
1443
-
1444
- <li class="never" data-hits="" data-linenumber="76">
1445
-
1446
-
1447
- <code class="ruby"> </code>
1448
- </li>
1449
-
1450
- <li class="never" data-hits="" data-linenumber="77">
1451
-
1452
-
1453
- <code class="ruby"> def eql?(other)</code>
1454
- </li>
1455
-
1456
- <li class="never" data-hits="" data-linenumber="78">
1457
-
1458
-
1459
- <code class="ruby"> return other.eql?(self) if other.is_a?(BooleanMatcher)</code>
1460
- </li>
1461
-
1462
- <li class="never" data-hits="" data-linenumber="79">
1463
-
1464
-
1465
- <code class="ruby"> return self.old_eql?(other)</code>
1466
- </li>
1467
-
1468
- <li class="never" data-hits="" data-linenumber="80">
1469
-
1470
-
1471
- <code class="ruby"> end</code>
1472
- </li>
1473
-
1474
- <li class="never" data-hits="" data-linenumber="81">
1475
-
1476
-
1477
- <code class="ruby"> EOE</code>
1478
- </li>
1479
-
1480
- <li class="never" data-hits="" data-linenumber="82">
1481
-
1482
-
1483
- <code class="ruby">end</code>
1484
- </li>
1485
-
1486
- <li class="never" data-hits="" data-linenumber="83">
1487
-
1488
-
1489
- <code class="ruby"></code>
1490
- </li>
1491
-
1492
- <li class="covered" data-hits="1" data-linenumber="84">
1493
- <span class="hits">1</span>
1494
-
1495
- <code class="ruby">class Numeric</code>
1496
- </li>
1497
-
1498
- <li class="covered" data-hits="1" data-linenumber="85">
1499
- <span class="hits">1</span>
1500
-
1501
- <code class="ruby"> def matcher(opts={})</code>
1502
- </li>
1503
-
1504
- <li class="covered" data-hits="4" data-linenumber="86">
1505
- <span class="hits">4</span>
1506
-
1507
- <code class="ruby"> PathString.new(&quot;:#{self}&quot;)</code>
1508
- </li>
1509
-
1510
- <li class="never" data-hits="" data-linenumber="87">
1511
-
1512
-
1513
- <code class="ruby"> end</code>
1514
- </li>
1515
-
1516
- <li class="covered" data-hits="1" data-linenumber="88">
1517
- <span class="hits">1</span>
1518
-
1519
- <code class="ruby"> def ==(other)</code>
1520
- </li>
1521
-
1522
- <li class="covered" data-hits="1" data-linenumber="89">
1523
- <span class="hits">1</span>
1524
-
1525
- <code class="ruby"> return true if other.is_a?(PathString) &amp;&amp; other =~ /^:/</code>
1526
- </li>
1527
-
1528
- <li class="covered" data-hits="1" data-linenumber="90">
1529
- <span class="hits">1</span>
1530
-
1531
- <code class="ruby"> super</code>
1532
- </li>
1533
-
1534
- <li class="never" data-hits="" data-linenumber="91">
1535
-
1536
-
1537
- <code class="ruby"> end</code>
1538
- </li>
1539
-
1540
- <li class="covered" data-hits="1" data-linenumber="92">
1541
- <span class="hits">1</span>
1542
-
1543
- <code class="ruby"> alias_method :eql?, :==</code>
1544
- </li>
1545
-
1546
- <li class="never" data-hits="" data-linenumber="93">
1547
-
1548
-
1549
- <code class="ruby">end</code>
1550
- </li>
1551
-
1552
- <li class="never" data-hits="" data-linenumber="94">
1553
-
1554
-
1555
- <code class="ruby"></code>
1556
- </li>
1557
-
1558
- <li class="never" data-hits="" data-linenumber="95">
1559
-
1560
-
1561
- <code class="ruby"># The only really important matcher</code>
1562
- </li>
1563
-
1564
- <li class="covered" data-hits="1" data-linenumber="96">
1565
- <span class="hits">1</span>
1566
-
1567
- <code class="ruby">class String</code>
1568
- </li>
1569
-
1570
- <li class="covered" data-hits="1" data-linenumber="97">
1571
- <span class="hits">1</span>
1572
-
1573
- <code class="ruby"> def matcher(opts = {})</code>
1574
- </li>
1575
-
1576
- <li class="never" data-hits="" data-linenumber="98">
1577
-
1578
-
1579
- <code class="ruby"> # if we have a leading : or a /:xyz - a matcher is already defined</code>
1580
- </li>
1581
-
1582
- <li class="covered" data-hits="34" data-linenumber="99">
1583
- <span class="hits">34</span>
1584
-
1585
- <code class="ruby"> self =~ /(^:|\/:)/ ? PathString.new(self) : PathString.new(&quot;:#{self}&quot;)</code>
1586
- </li>
1587
-
1588
- <li class="never" data-hits="" data-linenumber="100">
1589
-
1590
-
1591
- <code class="ruby"> end</code>
1592
- </li>
1593
-
1594
- <li class="covered" data-hits="1" data-linenumber="101">
1595
- <span class="hits">1</span>
1596
-
1597
- <code class="ruby"> define_method &quot;==_with_path_string&quot; do |other|</code>
1598
- </li>
1599
-
1600
- <li class="covered" data-hits="1558" data-linenumber="102">
1601
- <span class="hits">1558</span>
1602
-
1603
- <code class="ruby"> if other.is_a?(PathString)</code>
1604
- </li>
1605
-
1606
- <li class="covered" data-hits="20" data-linenumber="103">
1607
- <span class="hits">20</span>
1608
-
1609
- <code class="ruby"> return true if self.is_a?(PathString)</code>
1610
- </li>
1611
-
1612
- <li class="covered" data-hits="2" data-linenumber="104">
1613
- <span class="hits">2</span>
1614
-
1615
- <code class="ruby"> return other == self </code>
1616
- </li>
1617
-
1618
- <li class="never" data-hits="" data-linenumber="105">
1619
-
1620
-
1621
- <code class="ruby"> end</code>
1622
- </li>
1623
-
1624
- <li class="covered" data-hits="1538" data-linenumber="106">
1625
- <span class="hits">1538</span>
1626
-
1627
- <code class="ruby"> return self.send(&quot;==_without_path_string&quot;, other)</code>
1628
- </li>
1629
-
1630
- <li class="never" data-hits="" data-linenumber="107">
1631
-
1632
-
1633
- <code class="ruby"> end</code>
1634
- </li>
1635
-
1636
- <li class="covered" data-hits="1" data-linenumber="108">
1637
- <span class="hits">1</span>
1638
-
1639
- <code class="ruby"> alias_method &quot;==_without_path_string&quot;, :==</code>
1640
- </li>
1641
-
1642
- <li class="covered" data-hits="1" data-linenumber="109">
1643
- <span class="hits">1</span>
1644
-
1645
- <code class="ruby"> alias_method :==, &quot;==_with_path_string&quot;</code>
1646
- </li>
1647
-
1648
- <li class="covered" data-hits="1" data-linenumber="110">
1649
- <span class="hits">1</span>
1650
-
1651
- <code class="ruby"> alias_method :eql?, :==</code>
1652
- </li>
1653
-
1654
- <li class="never" data-hits="" data-linenumber="111">
1655
-
1656
-
1657
- <code class="ruby"> # make a string bold</code>
1658
- </li>
1659
-
1660
- <li class="covered" data-hits="1" data-linenumber="112">
1661
- <span class="hits">1</span>
1662
-
1663
- <code class="ruby"> def bold</code>
1664
- </li>
1665
-
1666
- <li class="missed" data-hits="0" data-linenumber="113">
1667
-
1668
-
1669
- <code class="ruby"> &quot;\033[1m#{self}&quot;</code>
1670
- </li>
1671
-
1672
- <li class="never" data-hits="" data-linenumber="114">
1673
-
1674
-
1675
- <code class="ruby"> end</code>
1676
- </li>
1677
-
1678
- <li class="never" data-hits="" data-linenumber="115">
1679
-
1680
-
1681
- <code class="ruby">end</code>
1682
- </li>
1683
-
1684
- <li class="never" data-hits="" data-linenumber="116">
1685
-
1686
-
1687
- <code class="ruby"></code>
1688
- </li>
1689
-
1690
- <li class="covered" data-hits="1" data-linenumber="117">
1691
- <span class="hits">1</span>
1692
-
1693
- <code class="ruby">class Hash</code>
1694
- </li>
1695
-
1696
- <li class="covered" data-hits="1" data-linenumber="118">
1697
- <span class="hits">1</span>
1698
-
1699
- <code class="ruby"> def pathify_strings</code>
1700
- </li>
1701
-
1702
- <li class="missed" data-hits="0" data-linenumber="119">
1703
-
1704
-
1705
- <code class="ruby"> self.each_pair do |k,v|</code>
1706
- </li>
1707
-
1708
- <li class="missed" data-hits="0" data-linenumber="120">
1709
-
1710
-
1711
- <code class="ruby"> if v.is_a?(Array) || v.is_a?(Hash)</code>
1712
- </li>
1713
-
1714
- <li class="missed" data-hits="0" data-linenumber="121">
1715
-
1716
-
1717
- <code class="ruby"> self[k] = v.pathify_strings</code>
1718
- </li>
1719
-
1720
- <li class="never" data-hits="" data-linenumber="122">
1721
-
1722
-
1723
- <code class="ruby"> elsif v.instance_of?(String) || v.is_a?(Numeric)</code>
1724
- </li>
1725
-
1726
- <li class="missed" data-hits="0" data-linenumber="123">
1727
-
1728
-
1729
- <code class="ruby"> self[k] = PathString.new(URI.decode(v.to_s))</code>
1730
- </li>
1731
-
1732
- <li class="never" data-hits="" data-linenumber="124">
1733
-
1734
-
1735
- <code class="ruby"> end</code>
1736
- </li>
1737
-
1738
- <li class="never" data-hits="" data-linenumber="125">
1739
-
1740
-
1741
- <code class="ruby"> end</code>
1742
- </li>
1743
-
1744
- <li class="missed" data-hits="0" data-linenumber="126">
1745
-
1746
-
1747
- <code class="ruby"> self</code>
1748
- </li>
1749
-
1750
- <li class="never" data-hits="" data-linenumber="127">
1751
-
1752
-
1753
- <code class="ruby"> end</code>
1754
- </li>
1755
-
1756
- <li class="never" data-hits="" data-linenumber="128">
1757
-
1758
-
1759
- <code class="ruby"> # recursively get a matcher for each value</code>
1760
- </li>
1761
-
1762
- <li class="covered" data-hits="1" data-linenumber="129">
1763
- <span class="hits">1</span>
1764
-
1765
- <code class="ruby"> def matcher(opts = {})</code>
1766
- </li>
1767
-
1768
- <li class="covered" data-hits="41" data-linenumber="130">
1769
- <span class="hits">41</span>
1770
-
1771
- <code class="ruby"> opts[:only] ||= self.keys.collect(&amp;:to_sym)</code>
1772
- </li>
1773
-
1774
- <li class="covered" data-hits="41" data-linenumber="131">
1775
- <span class="hits">41</span>
1776
-
1777
- <code class="ruby"> opts[:only] = opts[:only].collect(&amp;:to_sym)</code>
1778
- </li>
1779
-
1780
- <li class="covered" data-hits="41" data-linenumber="132">
1781
- <span class="hits">41</span>
1782
-
1783
- <code class="ruby"> opts[:only] -= (opts[:except] || []).collect(&amp;:to_sym)</code>
1784
- </li>
1785
-
1786
- <li class="never" data-hits="" data-linenumber="133">
1787
-
1788
-
1789
- <code class="ruby"> </code>
1790
- </li>
1791
-
1792
- <li class="covered" data-hits="41" data-linenumber="134">
1793
- <span class="hits">41</span>
1794
-
1795
- <code class="ruby"> ret = self.class.new</code>
1796
- </li>
1797
-
1798
- <li class="covered" data-hits="41" data-linenumber="135">
1799
- <span class="hits">41</span>
1800
-
1801
- <code class="ruby"> self.each_pair do |k,v|</code>
1802
- </li>
1803
-
1804
- <li class="covered" data-hits="61" data-linenumber="136">
1805
- <span class="hits">61</span>
1806
-
1807
- <code class="ruby"> if opts[:only].include?(k.to_sym)</code>
1808
- </li>
1809
-
1810
- <li class="covered" data-hits="51" data-linenumber="137">
1811
- <span class="hits">51</span>
1812
-
1813
- <code class="ruby"> ret[k] = v.matcher(opts[k.to_sym] || {})</code>
1814
- </li>
1815
-
1816
- <li class="never" data-hits="" data-linenumber="138">
1817
-
1818
-
1819
- <code class="ruby"> else</code>
1820
- </li>
1821
-
1822
- <li class="never" data-hits="" data-linenumber="139">
1823
-
1824
-
1825
- <code class="ruby"> # Still try to pathify strings if this is an array or hash</code>
1826
- </li>
1827
-
1828
- <li class="covered" data-hits="10" data-linenumber="140">
1829
- <span class="hits">10</span>
1830
-
1831
- <code class="ruby"> if v.is_a?(Array) || v.is_a?(Hash)</code>
1832
- </li>
1833
-
1834
- <li class="missed" data-hits="0" data-linenumber="141">
1835
-
1836
-
1837
- <code class="ruby"> ret[k] = v.pathify_strings</code>
1838
- </li>
1839
-
1840
- <li class="never" data-hits="" data-linenumber="142">
1841
-
1842
-
1843
- <code class="ruby"> else</code>
1844
- </li>
1845
-
1846
- <li class="covered" data-hits="10" data-linenumber="143">
1847
- <span class="hits">10</span>
1848
-
1849
- <code class="ruby"> ret[k] = v</code>
1850
- </li>
1851
-
1852
- <li class="never" data-hits="" data-linenumber="144">
1853
-
1854
-
1855
- <code class="ruby"> end</code>
1856
- </li>
1857
-
1858
- <li class="never" data-hits="" data-linenumber="145">
1859
-
1860
-
1861
- <code class="ruby"> end</code>
1862
- </li>
1863
-
1864
- <li class="never" data-hits="" data-linenumber="146">
1865
-
1866
-
1867
- <code class="ruby"> end</code>
1868
- </li>
1869
-
1870
- <li class="covered" data-hits="41" data-linenumber="147">
1871
- <span class="hits">41</span>
1872
-
1873
- <code class="ruby"> ret</code>
1874
- </li>
1875
-
1876
- <li class="never" data-hits="" data-linenumber="148">
1877
-
1878
-
1879
- <code class="ruby"> end</code>
1880
- </li>
1881
-
1882
- <li class="never" data-hits="" data-linenumber="149">
1883
-
1884
-
1885
- <code class="ruby">end</code>
1886
- </li>
1887
-
1888
- <li class="covered" data-hits="1" data-linenumber="150">
1889
- <span class="hits">1</span>
1890
-
1891
- <code class="ruby">class Array</code>
1892
- </li>
1893
-
1894
- <li class="covered" data-hits="1" data-linenumber="151">
1895
- <span class="hits">1</span>
1896
-
1897
- <code class="ruby"> def pathify_strings</code>
1898
- </li>
1899
-
1900
- <li class="covered" data-hits="44" data-linenumber="152">
1901
- <span class="hits">44</span>
1902
-
1903
- <code class="ruby"> if self.first == &quot;:matcher&quot;</code>
1904
- </li>
1905
-
1906
- <li class="missed" data-hits="0" data-linenumber="153">
1907
-
1908
-
1909
- <code class="ruby"> val = VariableArray.new(self)</code>
1910
- </li>
1911
-
1912
- <li class="never" data-hits="" data-linenumber="154">
1913
-
1914
-
1915
- <code class="ruby"> else</code>
1916
- </li>
1917
-
1918
- <li class="covered" data-hits="44" data-linenumber="155">
1919
- <span class="hits">44</span>
1920
-
1921
- <code class="ruby"> val = self</code>
1922
- </li>
1923
-
1924
- <li class="never" data-hits="" data-linenumber="156">
1925
-
1926
-
1927
- <code class="ruby"> end</code>
1928
- </li>
1929
-
1930
- <li class="covered" data-hits="44" data-linenumber="157">
1931
- <span class="hits">44</span>
1932
-
1933
- <code class="ruby"> val.each_with_index do |v,k|</code>
1934
- </li>
1935
-
1936
- <li class="covered" data-hits="104" data-linenumber="158">
1937
- <span class="hits">104</span>
1938
-
1939
- <code class="ruby"> if v.is_a?(Array) || v.is_a?(Hash)</code>
1940
- </li>
1941
-
1942
- <li class="covered" data-hits="38" data-linenumber="159">
1943
- <span class="hits">38</span>
1944
-
1945
- <code class="ruby"> val[k] = v.pathify_strings</code>
1946
- </li>
1947
-
1948
- <li class="never" data-hits="" data-linenumber="160">
1949
-
1950
-
1951
- <code class="ruby"> elsif v.instance_of?(String) || v.is_a?(Numeric)</code>
1952
- </li>
1953
-
1954
- <li class="covered" data-hits="66" data-linenumber="161">
1955
- <span class="hits">66</span>
1956
-
1957
- <code class="ruby"> val[k] = PathString.new(URI.decode(v.to_s))</code>
1958
- </li>
1959
-
1960
- <li class="never" data-hits="" data-linenumber="162">
1961
-
1962
-
1963
- <code class="ruby"> end</code>
1964
- </li>
1965
-
1966
- <li class="never" data-hits="" data-linenumber="163">
1967
-
1968
-
1969
- <code class="ruby"> end</code>
1970
- </li>
1971
-
1972
- <li class="covered" data-hits="44" data-linenumber="164">
1973
- <span class="hits">44</span>
1974
-
1975
- <code class="ruby"> val</code>
1976
- </li>
1977
-
1978
- <li class="never" data-hits="" data-linenumber="165">
1979
-
1980
-
1981
- <code class="ruby"> end</code>
1982
- </li>
1983
-
1984
- <li class="never" data-hits="" data-linenumber="166">
1985
-
1986
-
1987
- <code class="ruby"> # call matcher on all of the elements</code>
1988
- </li>
1989
-
1990
- <li class="covered" data-hits="1" data-linenumber="167">
1991
- <span class="hits">1</span>
1992
-
1993
- <code class="ruby"> def matcher(opts = {})</code>
1994
- </li>
1995
-
1996
- <li class="covered" data-hits="5" data-linenumber="168">
1997
- <span class="hits">5</span>
1998
-
1999
- <code class="ruby"> klone = self.clone</code>
2000
- </li>
2001
-
2002
- <li class="covered" data-hits="5" data-linenumber="169">
2003
- <span class="hits">5</span>
2004
-
2005
- <code class="ruby"> klone.unshift(&quot;:matcher&quot;)</code>
2006
- </li>
2007
-
2008
- <li class="covered" data-hits="5" data-linenumber="170">
2009
- <span class="hits">5</span>
2010
-
2011
- <code class="ruby"> VariableArray.new(klone.collect(&amp;:matcher))</code>
2012
- </li>
2013
-
2014
- <li class="never" data-hits="" data-linenumber="171">
2015
-
2016
-
2017
- <code class="ruby"> end</code>
2018
- </li>
2019
-
2020
- <li class="never" data-hits="" data-linenumber="172">
2021
-
2022
-
2023
- <code class="ruby"> # we want this to apply to both :eql? and ==</code>
2024
- </li>
2025
-
2026
- <li class="covered" data-hits="1" data-linenumber="173">
2027
- <span class="hits">1</span>
2028
-
2029
- <code class="ruby"> alias_method :eql?, :==</code>
2030
- </li>
2031
-
2032
- <li class="never" data-hits="" data-linenumber="174">
2033
-
2034
-
2035
- <code class="ruby"> # we want this to add decorator behavior to ==, proxying to VariableArray if possible</code>
2036
- </li>
2037
-
2038
- <li class="covered" data-hits="1" data-linenumber="175">
2039
- <span class="hits">1</span>
2040
-
2041
- <code class="ruby"> define_method &quot;==_with_variable_array&quot; do |other|</code>
2042
- </li>
2043
-
2044
- <li class="covered" data-hits="32" data-linenumber="176">
2045
- <span class="hits">32</span>
2046
-
2047
- <code class="ruby"> return other == self if other.is_a?(VariableArray)</code>
2048
- </li>
2049
-
2050
- <li class="covered" data-hits="30" data-linenumber="177">
2051
- <span class="hits">30</span>
2052
-
2053
- <code class="ruby"> self.send(&quot;==_without_variable_array&quot;,other)</code>
2054
- </li>
2055
-
2056
- <li class="never" data-hits="" data-linenumber="178">
2057
-
2058
-
2059
- <code class="ruby"> end</code>
2060
- </li>
2061
-
2062
- <li class="never" data-hits="" data-linenumber="179">
2063
-
2064
-
2065
- <code class="ruby"> # Equivalent to:</code>
2066
- </li>
2067
-
2068
- <li class="never" data-hits="" data-linenumber="180">
2069
-
2070
-
2071
- <code class="ruby"> # alias_method_chain &quot;==&quot;, &quot;variable_array&quot;</code>
2072
- </li>
2073
-
2074
- <li class="covered" data-hits="1" data-linenumber="181">
2075
- <span class="hits">1</span>
2076
-
2077
- <code class="ruby"> alias_method &quot;==_without_variable_array&quot;, :==</code>
2078
- </li>
2079
-
2080
- <li class="covered" data-hits="1" data-linenumber="182">
2081
- <span class="hits">1</span>
2082
-
2083
- <code class="ruby"> alias_method :==, &quot;==_with_variable_array&quot;</code>
2084
- </li>
2085
-
2086
- <li class="never" data-hits="" data-linenumber="183">
2087
-
2088
-
2089
- <code class="ruby">end</code>
2090
- </li>
2091
-
2092
- </ol>
2093
- </pre>
2094
- </div>
2095
-
2096
- <div class="source_table" id="7ee6b0eb3c9dcde6be408d6b4f636325ec8416f6">
2097
- <div class="header">
2098
- <h3>lib/hash.rb</h3>
2099
- <h4><span class="green">93.75 %</span> covered</h4>
2100
- <div>
2101
- <b>32</b> relevant lines.
2102
- <span class="green"><b>30</b> lines covered</span> and
2103
- <span class="red"><b>2</b> lines missed.</span>
2104
- </div>
2105
- </div>
2106
-
2107
- <pre>
2108
- <ol>
2109
-
2110
- <li class="covered" data-hits="1" data-linenumber="1">
2111
- <span class="hits">1</span>
2112
-
2113
- <code class="ruby">class HashDealer</code>
2114
- </li>
2115
-
2116
- <li class="covered" data-hits="1" data-linenumber="2">
2117
- <span class="hits">1</span>
2118
-
2119
- <code class="ruby"> class Hash &lt; ::Hash</code>
2120
- </li>
2121
-
2122
- <li class="never" data-hits="" data-linenumber="3">
2123
-
2124
-
2125
- <code class="ruby"></code>
2126
- </li>
2127
-
2128
- <li class="covered" data-hits="1" data-linenumber="4">
2129
- <span class="hits">1</span>
2130
-
2131
- <code class="ruby"> attr_accessor :optional_attributes</code>
2132
- </li>
2133
-
2134
- <li class="never" data-hits="" data-linenumber="5">
2135
-
2136
-
2137
- <code class="ruby"></code>
2138
- </li>
2139
-
2140
- <li class="covered" data-hits="1" data-linenumber="6">
2141
- <span class="hits">1</span>
2142
-
2143
- <code class="ruby"> def initialize(optional_attributes = [])</code>
2144
- </li>
2145
-
2146
- <li class="covered" data-hits="82" data-linenumber="7">
2147
- <span class="hits">82</span>
2148
-
2149
- <code class="ruby"> @optional_attributes = optional_attributes</code>
2150
- </li>
2151
-
2152
- <li class="never" data-hits="" data-linenumber="8">
2153
-
2154
-
2155
- <code class="ruby"> end</code>
2156
- </li>
2157
-
2158
- <li class="never" data-hits="" data-linenumber="9">
2159
-
2160
-
2161
- <code class="ruby"></code>
2162
- </li>
2163
-
2164
- <li class="covered" data-hits="1" data-linenumber="10">
2165
- <span class="hits">1</span>
2166
-
2167
- <code class="ruby"> def eql?(other)</code>
2168
- </li>
2169
-
2170
- <li class="covered" data-hits="18" data-linenumber="11">
2171
- <span class="hits">18</span>
2172
-
2173
- <code class="ruby"> self_copy, other_copy = self.get_copies_for_comparison(other)</code>
2174
- </li>
2175
-
2176
- <li class="covered" data-hits="18" data-linenumber="12">
2177
- <span class="hits">18</span>
2178
-
2179
- <code class="ruby"> self_copy.eql?(other_copy)</code>
2180
- </li>
2181
-
2182
- <li class="never" data-hits="" data-linenumber="13">
2183
-
2184
-
2185
- <code class="ruby"> end</code>
2186
- </li>
2187
-
2188
- <li class="never" data-hits="" data-linenumber="14">
2189
-
2190
-
2191
- <code class="ruby"></code>
2192
- </li>
2193
-
2194
- <li class="covered" data-hits="1" data-linenumber="15">
2195
- <span class="hits">1</span>
2196
-
2197
- <code class="ruby"> def matcher(opts = {})</code>
2198
- </li>
2199
-
2200
- <li class="covered" data-hits="20" data-linenumber="16">
2201
- <span class="hits">20</span>
2202
-
2203
- <code class="ruby"> ret = super</code>
2204
- </li>
2205
-
2206
- <li class="covered" data-hits="20" data-linenumber="17">
2207
- <span class="hits">20</span>
2208
-
2209
- <code class="ruby"> ret.optional_attributes = self.optional_attributes</code>
2210
- </li>
2211
-
2212
- <li class="covered" data-hits="20" data-linenumber="18">
2213
- <span class="hits">20</span>
2214
-
2215
- <code class="ruby"> ret</code>
2216
- </li>
2217
-
2218
- <li class="never" data-hits="" data-linenumber="19">
2219
-
2220
-
2221
- <code class="ruby"> end</code>
2222
- </li>
2223
-
2224
- <li class="never" data-hits="" data-linenumber="20">
2225
-
2226
-
2227
- <code class="ruby"></code>
2228
- </li>
2229
-
2230
- <li class="covered" data-hits="1" data-linenumber="21">
2231
- <span class="hits">1</span>
2232
-
2233
- <code class="ruby"> def ==(other)</code>
2234
- </li>
2235
-
2236
- <li class="missed" data-hits="0" data-linenumber="22">
2237
-
2238
-
2239
- <code class="ruby"> self_copy, other_copy = self.get_copies_for_comparison(other)</code>
2240
- </li>
2241
-
2242
- <li class="missed" data-hits="0" data-linenumber="23">
2243
-
2244
-
2245
- <code class="ruby"> self_copy == other_copy</code>
2246
- </li>
2247
-
2248
- <li class="never" data-hits="" data-linenumber="24">
2249
-
2250
-
2251
- <code class="ruby"> end</code>
2252
- </li>
2253
-
2254
- <li class="never" data-hits="" data-linenumber="25">
2255
-
2256
-
2257
- <code class="ruby"></code>
2258
- </li>
2259
-
2260
- <li class="covered" data-hits="1" data-linenumber="26">
2261
- <span class="hits">1</span>
2262
-
2263
- <code class="ruby"> def stringify_keys</code>
2264
- </li>
2265
-
2266
- <li class="covered" data-hits="7" data-linenumber="27">
2267
- <span class="hits">7</span>
2268
-
2269
- <code class="ruby"> ret = super</code>
2270
- </li>
2271
-
2272
- <li class="covered" data-hits="7" data-linenumber="28">
2273
- <span class="hits">7</span>
2274
-
2275
- <code class="ruby"> ret.optional_attributes = self.optional_attributes.collect(&amp;:to_s)</code>
2276
- </li>
2277
-
2278
- <li class="covered" data-hits="7" data-linenumber="29">
2279
- <span class="hits">7</span>
2280
-
2281
- <code class="ruby"> ret</code>
2282
- </li>
2283
-
2284
- <li class="never" data-hits="" data-linenumber="30">
2285
-
2286
-
2287
- <code class="ruby"> end</code>
2288
- </li>
2289
-
2290
- <li class="never" data-hits="" data-linenumber="31">
2291
-
2292
-
2293
- <code class="ruby"></code>
2294
- </li>
2295
-
2296
- <li class="covered" data-hits="1" data-linenumber="32">
2297
- <span class="hits">1</span>
2298
-
2299
- <code class="ruby"> def to_hash</code>
2300
- </li>
2301
-
2302
- <li class="covered" data-hits="18" data-linenumber="33">
2303
- <span class="hits">18</span>
2304
-
2305
- <code class="ruby"> ret = ::Hash.new</code>
2306
- </li>
2307
-
2308
- <li class="covered" data-hits="18" data-linenumber="34">
2309
- <span class="hits">18</span>
2310
-
2311
- <code class="ruby"> self.each_pair do |k,v|</code>
2312
- </li>
2313
-
2314
- <li class="covered" data-hits="34" data-linenumber="35">
2315
- <span class="hits">34</span>
2316
-
2317
- <code class="ruby"> ret[k] = v</code>
2318
- </li>
2319
-
2320
- <li class="never" data-hits="" data-linenumber="36">
2321
-
2322
-
2323
- <code class="ruby"> end</code>
2324
- </li>
2325
-
2326
- <li class="covered" data-hits="18" data-linenumber="37">
2327
- <span class="hits">18</span>
2328
-
2329
- <code class="ruby"> ret</code>
2330
- </li>
2331
-
2332
- <li class="never" data-hits="" data-linenumber="38">
2333
-
2334
-
2335
- <code class="ruby"> end</code>
2336
- </li>
2337
-
2338
- <li class="never" data-hits="" data-linenumber="39">
2339
-
2340
-
2341
- <code class="ruby"></code>
2342
- </li>
2343
-
2344
- <li class="covered" data-hits="1" data-linenumber="40">
2345
- <span class="hits">1</span>
2346
-
2347
- <code class="ruby"> protected</code>
2348
- </li>
2349
-
2350
- <li class="never" data-hits="" data-linenumber="41">
2351
-
2352
-
2353
- <code class="ruby"></code>
2354
- </li>
2355
-
2356
- <li class="covered" data-hits="1" data-linenumber="42">
2357
- <span class="hits">1</span>
2358
-
2359
- <code class="ruby"> def get_copies_for_comparison(other)</code>
2360
- </li>
2361
-
2362
- <li class="covered" data-hits="18" data-linenumber="43">
2363
- <span class="hits">18</span>
2364
-
2365
- <code class="ruby"> [self.remove_optional_keys(self), self.remove_optional_keys(other)]</code>
2366
- </li>
2367
-
2368
- <li class="never" data-hits="" data-linenumber="44">
2369
-
2370
-
2371
- <code class="ruby"> end</code>
2372
- </li>
2373
-
2374
- <li class="never" data-hits="" data-linenumber="45">
2375
-
2376
-
2377
- <code class="ruby"></code>
2378
- </li>
2379
-
2380
- <li class="covered" data-hits="1" data-linenumber="46">
2381
- <span class="hits">1</span>
2382
-
2383
- <code class="ruby"> def remove_optional_keys(hash)</code>
2384
- </li>
2385
-
2386
- <li class="covered" data-hits="36" data-linenumber="47">
2387
- <span class="hits">36</span>
2388
-
2389
- <code class="ruby"> hash = hash.clone.to_hash</code>
2390
- </li>
2391
-
2392
- <li class="covered" data-hits="36" data-linenumber="48">
2393
- <span class="hits">36</span>
2394
-
2395
- <code class="ruby"> @optional_attributes.each do |optional_attribute|</code>
2396
- </li>
2397
-
2398
- <li class="covered" data-hits="20" data-linenumber="49">
2399
- <span class="hits">20</span>
2400
-
2401
- <code class="ruby"> hash.delete(optional_attribute)</code>
2402
- </li>
2403
-
2404
- <li class="never" data-hits="" data-linenumber="50">
2405
-
2406
-
2407
- <code class="ruby"> end</code>
2408
- </li>
2409
-
2410
- <li class="covered" data-hits="36" data-linenumber="51">
2411
- <span class="hits">36</span>
2412
-
2413
- <code class="ruby"> hash</code>
2414
- </li>
2415
-
2416
- <li class="never" data-hits="" data-linenumber="52">
2417
-
2418
-
2419
- <code class="ruby"> end</code>
2420
- </li>
2421
-
2422
- <li class="never" data-hits="" data-linenumber="53">
2423
-
2424
-
2425
- <code class="ruby"></code>
2426
- </li>
2427
-
2428
- <li class="never" data-hits="" data-linenumber="54">
2429
-
2430
-
2431
- <code class="ruby"> end</code>
2432
- </li>
2433
-
2434
- <li class="never" data-hits="" data-linenumber="55">
2435
-
2436
-
2437
- <code class="ruby">end</code>
2438
- </li>
2439
-
2440
- </ol>
2441
- </pre>
2442
- </div>
2443
-
2444
- <div class="source_table" id="9082f1e417147c61ee326c565b15a99cad953b35">
2445
- <div class="header">
2446
- <h3>lib/hash_dealer.rb</h3>
2447
- <h4><span class="green">95.83 %</span> covered</h4>
2448
- <div>
2449
- <b>48</b> relevant lines.
2450
- <span class="green"><b>46</b> lines covered</span> and
2451
- <span class="red"><b>2</b> lines missed.</span>
2452
- </div>
2453
- </div>
2454
-
2455
- <pre>
2456
- <ol>
2457
-
2458
- <li class="covered" data-hits="1" data-linenumber="1">
2459
- <span class="hits">1</span>
2460
-
2461
- <code class="ruby">require 'colorize'</code>
2462
- </li>
2463
-
2464
- <li class="never" data-hits="" data-linenumber="2">
2465
-
2466
-
2467
- <code class="ruby"></code>
2468
- </li>
2469
-
2470
- <li class="covered" data-hits="1" data-linenumber="3">
2471
- <span class="hits">1</span>
2472
-
2473
- <code class="ruby">require File.expand_path('../path_string', __FILE__)</code>
2474
- </li>
2475
-
2476
- <li class="covered" data-hits="1" data-linenumber="4">
2477
- <span class="hits">1</span>
2478
-
2479
- <code class="ruby">require File.expand_path('../variable_array', __FILE__)</code>
2480
- </li>
2481
-
2482
- <li class="covered" data-hits="1" data-linenumber="5">
2483
- <span class="hits">1</span>
2484
-
2485
- <code class="ruby">require File.expand_path('../core_extensions', __FILE__)</code>
2486
- </li>
2487
-
2488
- <li class="covered" data-hits="1" data-linenumber="6">
2489
- <span class="hits">1</span>
2490
-
2491
- <code class="ruby">require File.expand_path('../matcher', __FILE__)</code>
2492
- </li>
2493
-
2494
- <li class="covered" data-hits="1" data-linenumber="7">
2495
- <span class="hits">1</span>
2496
-
2497
- <code class="ruby">require File.expand_path('../comparator', __FILE__)</code>
2498
- </li>
2499
-
2500
- <li class="covered" data-hits="1" data-linenumber="8">
2501
- <span class="hits">1</span>
2502
-
2503
- <code class="ruby">require File.expand_path('../hash', __FILE__)</code>
2504
- </li>
2505
-
2506
- <li class="never" data-hits="" data-linenumber="9">
2507
-
2508
-
2509
- <code class="ruby"></code>
2510
- </li>
2511
-
2512
- <li class="covered" data-hits="1" data-linenumber="10">
2513
- <span class="hits">1</span>
2514
-
2515
- <code class="ruby">class HashDealer</code>
2516
- </li>
2517
-
2518
- <li class="never" data-hits="" data-linenumber="11">
2519
-
2520
-
2521
- <code class="ruby"> </code>
2522
- </li>
2523
-
2524
- <li class="covered" data-hits="1" data-linenumber="12">
2525
- <span class="hits">1</span>
2526
-
2527
- <code class="ruby"> attr_accessor :parent</code>
2528
- </li>
2529
-
2530
- <li class="covered" data-hits="1" data-linenumber="13">
2531
- <span class="hits">1</span>
2532
-
2533
- <code class="ruby"> attr_accessor :optional_attributes</code>
2534
- </li>
2535
-
2536
- <li class="never" data-hits="" data-linenumber="14">
2537
-
2538
-
2539
- <code class="ruby"></code>
2540
- </li>
2541
-
2542
- <li class="never" data-hits="" data-linenumber="15">
2543
-
2544
-
2545
- <code class="ruby"> # cattr_accessor</code>
2546
- </li>
2547
-
2548
- <li class="covered" data-hits="1" data-linenumber="16">
2549
- <span class="hits">1</span>
2550
-
2551
- <code class="ruby"> def self.hashes</code>
2552
- </li>
2553
-
2554
- <li class="covered" data-hits="240" data-linenumber="17">
2555
- <span class="hits">240</span>
2556
-
2557
- <code class="ruby"> @hashes ||= {}</code>
2558
- </li>
2559
-
2560
- <li class="never" data-hits="" data-linenumber="18">
2561
-
2562
-
2563
- <code class="ruby"> end</code>
2564
- </li>
2565
-
2566
- <li class="never" data-hits="" data-linenumber="19">
2567
-
2568
-
2569
- <code class="ruby"> </code>
2570
- </li>
2571
-
2572
- <li class="never" data-hits="" data-linenumber="20">
2573
-
2574
-
2575
- <code class="ruby"> # define a method of the request factory</code>
2576
- </li>
2577
-
2578
- <li class="covered" data-hits="1" data-linenumber="21">
2579
- <span class="hits">1</span>
2580
-
2581
- <code class="ruby"> def self.define(name, opts = {}, &amp;block)</code>
2582
- </li>
2583
-
2584
- <li class="covered" data-hits="27" data-linenumber="22">
2585
- <span class="hits">27</span>
2586
-
2587
- <code class="ruby"> self.hashes[name] = [opts, block]</code>
2588
- </li>
2589
-
2590
- <li class="never" data-hits="" data-linenumber="23">
2591
-
2592
-
2593
- <code class="ruby"> end</code>
2594
- </li>
2595
-
2596
- <li class="never" data-hits="" data-linenumber="24">
2597
-
2598
-
2599
- <code class="ruby"> </code>
2600
- </li>
2601
-
2602
- <li class="covered" data-hits="1" data-linenumber="25">
2603
- <span class="hits">1</span>
2604
-
2605
- <code class="ruby"> def self.roll(name, overrides = {})</code>
2606
- </li>
2607
-
2608
- <li class="covered" data-hits="44" data-linenumber="26">
2609
- <span class="hits">44</span>
2610
-
2611
- <code class="ruby"> raise Exception.new(&quot;No HashDealer called #{name}&quot;) unless self.hashes[name]</code>
2612
- </li>
2613
-
2614
- <li class="covered" data-hits="44" data-linenumber="27">
2615
- <span class="hits">44</span>
2616
-
2617
- <code class="ruby"> self.hashes[name] = self.new(self.hashes[name][0], &amp;self.hashes[name][1]) unless self.hashes[name].is_a?(HashDealer)</code>
2618
- </li>
2619
-
2620
- <li class="never" data-hits="" data-linenumber="28">
2621
-
2622
-
2623
- <code class="ruby"></code>
2624
- </li>
2625
-
2626
- <li class="covered" data-hits="44" data-linenumber="29">
2627
- <span class="hits">44</span>
2628
-
2629
- <code class="ruby"> self.hashes[name]._attributes(overrides)</code>
2630
- </li>
2631
-
2632
- <li class="never" data-hits="" data-linenumber="30">
2633
-
2634
-
2635
- <code class="ruby"> end</code>
2636
- </li>
2637
-
2638
- <li class="never" data-hits="" data-linenumber="31">
2639
-
2640
-
2641
- <code class="ruby"> </code>
2642
- </li>
2643
-
2644
- <li class="never" data-hits="" data-linenumber="32">
2645
-
2646
-
2647
- <code class="ruby"> # initializer just calls the block from within our DSL</code>
2648
- </li>
2649
-
2650
- <li class="covered" data-hits="1" data-linenumber="33">
2651
- <span class="hits">1</span>
2652
-
2653
- <code class="ruby"> def initialize(opts = {}, &amp;block)</code>
2654
- </li>
2655
-
2656
- <li class="covered" data-hits="27" data-linenumber="34">
2657
- <span class="hits">27</span>
2658
-
2659
- <code class="ruby"> @parent = opts[:parent]</code>
2660
- </li>
2661
-
2662
- <li class="covered" data-hits="27" data-linenumber="35">
2663
- <span class="hits">27</span>
2664
-
2665
- <code class="ruby"> @optional_attributes = []</code>
2666
- </li>
2667
-
2668
- <li class="covered" data-hits="27" data-linenumber="36">
2669
- <span class="hits">27</span>
2670
-
2671
- <code class="ruby"> instance_eval(&amp;block)</code>
2672
- </li>
2673
-
2674
- <li class="never" data-hits="" data-linenumber="37">
2675
-
2676
-
2677
- <code class="ruby"> end</code>
2678
- </li>
2679
-
2680
- <li class="never" data-hits="" data-linenumber="38">
2681
-
2682
-
2683
- <code class="ruby"> </code>
2684
- </li>
2685
-
2686
- <li class="never" data-hits="" data-linenumber="39">
2687
-
2688
-
2689
- <code class="ruby"> # set the value as the root element for attributes</code>
2690
- </li>
2691
-
2692
- <li class="covered" data-hits="1" data-linenumber="40">
2693
- <span class="hits">1</span>
2694
-
2695
- <code class="ruby"> def root(value)</code>
2696
- </li>
2697
-
2698
- <li class="covered" data-hits="3" data-linenumber="41">
2699
- <span class="hits">3</span>
2700
-
2701
- <code class="ruby"> @attributes = value</code>
2702
- </li>
2703
-
2704
- <li class="never" data-hits="" data-linenumber="42">
2705
-
2706
-
2707
- <code class="ruby"> end</code>
2708
- </li>
2709
-
2710
- <li class="never" data-hits="" data-linenumber="43">
2711
-
2712
-
2713
- <code class="ruby"></code>
2714
- </li>
2715
-
2716
- <li class="covered" data-hits="1" data-linenumber="44">
2717
- <span class="hits">1</span>
2718
-
2719
- <code class="ruby"> def [](val)</code>
2720
- </li>
2721
-
2722
- <li class="missed" data-hits="0" data-linenumber="45">
2723
-
2724
-
2725
- <code class="ruby"> @attributes[val]</code>
2726
- </li>
2727
-
2728
- <li class="never" data-hits="" data-linenumber="46">
2729
-
2730
-
2731
- <code class="ruby"> end</code>
2732
- </li>
2733
-
2734
- <li class="never" data-hits="" data-linenumber="47">
2735
-
2736
-
2737
- <code class="ruby"> </code>
2738
- </li>
2739
-
2740
- <li class="never" data-hits="" data-linenumber="48">
2741
-
2742
-
2743
- <code class="ruby"> # get the stored attributes for this HashDealer</code>
2744
- </li>
2745
-
2746
- <li class="covered" data-hits="1" data-linenumber="49">
2747
- <span class="hits">1</span>
2748
-
2749
- <code class="ruby"> def _attributes(overrides)</code>
2750
- </li>
2751
-
2752
- <li class="never" data-hits="" data-linenumber="50">
2753
-
2754
-
2755
- <code class="ruby"> # allows us to set a root value</code>
2756
- </li>
2757
-
2758
- <li class="covered" data-hits="44" data-linenumber="51">
2759
- <span class="hits">44</span>
2760
-
2761
- <code class="ruby"> return @attributes.clone unless @attributes.is_a?(Hash)</code>
2762
- </li>
2763
-
2764
- <li class="never" data-hits="" data-linenumber="52">
2765
-
2766
-
2767
- <code class="ruby"></code>
2768
- </li>
2769
-
2770
- <li class="covered" data-hits="40" data-linenumber="53">
2771
- <span class="hits">40</span>
2772
-
2773
- <code class="ruby"> if @parent.present?</code>
2774
- </li>
2775
-
2776
- <li class="covered" data-hits="2" data-linenumber="54">
2777
- <span class="hits">2</span>
2778
-
2779
- <code class="ruby"> att = HashDealer.roll(@parent.to_sym)</code>
2780
- </li>
2781
-
2782
- <li class="never" data-hits="" data-linenumber="55">
2783
-
2784
-
2785
- <code class="ruby"> else</code>
2786
- </li>
2787
-
2788
- <li class="covered" data-hits="38" data-linenumber="56">
2789
- <span class="hits">38</span>
2790
-
2791
- <code class="ruby"> att = HashDealer::Hash.new(self.optional_attributes)</code>
2792
- </li>
2793
-
2794
- <li class="never" data-hits="" data-linenumber="57">
2795
-
2796
-
2797
- <code class="ruby"> end</code>
2798
- </li>
2799
-
2800
- <li class="never" data-hits="" data-linenumber="58">
2801
-
2802
-
2803
- <code class="ruby"></code>
2804
- </li>
2805
-
2806
- <li class="covered" data-hits="40" data-linenumber="59">
2807
- <span class="hits">40</span>
2808
-
2809
- <code class="ruby"> @attributes.each do |k,v|</code>
2810
- </li>
2811
-
2812
- <li class="covered" data-hits="66" data-linenumber="60">
2813
- <span class="hits">66</span>
2814
-
2815
- <code class="ruby"> att[k] = v.is_a?(Proc) ? v.call(att.merge(overrides)) : v</code>
2816
- </li>
2817
-
2818
- <li class="never" data-hits="" data-linenumber="61">
2819
-
2820
-
2821
- <code class="ruby"> end</code>
2822
- </li>
2823
-
2824
- <li class="never" data-hits="" data-linenumber="62">
2825
-
2826
-
2827
- <code class="ruby"> # if we have a hash as the first arg, it would override the attributes</code>
2828
- </li>
2829
-
2830
- <li class="covered" data-hits="40" data-linenumber="63">
2831
- <span class="hits">40</span>
2832
-
2833
- <code class="ruby"> overrides.each_pair do |k,v|</code>
2834
- </li>
2835
-
2836
- <li class="covered" data-hits="2" data-linenumber="64">
2837
- <span class="hits">2</span>
2838
-
2839
- <code class="ruby"> att[k.to_sym] = v if att.has_key?(k.to_sym)</code>
2840
- </li>
2841
-
2842
- <li class="never" data-hits="" data-linenumber="65">
2843
-
2844
-
2845
- <code class="ruby"> end</code>
2846
- </li>
2847
-
2848
- <li class="covered" data-hits="40" data-linenumber="66">
2849
- <span class="hits">40</span>
2850
-
2851
- <code class="ruby"> att</code>
2852
- </li>
2853
-
2854
- <li class="never" data-hits="" data-linenumber="67">
2855
-
2856
-
2857
- <code class="ruby"> end</code>
2858
- </li>
2859
-
2860
- <li class="never" data-hits="" data-linenumber="68">
2861
-
2862
-
2863
- <code class="ruby"> </code>
2864
- </li>
2865
-
2866
- <li class="covered" data-hits="1" data-linenumber="69">
2867
- <span class="hits">1</span>
2868
-
2869
- <code class="ruby"> protected</code>
2870
- </li>
2871
-
2872
- <li class="never" data-hits="" data-linenumber="70">
2873
-
2874
-
2875
- <code class="ruby"> </code>
2876
- </li>
2877
-
2878
- <li class="never" data-hits="" data-linenumber="71">
2879
-
2880
-
2881
- <code class="ruby"> # method missing</code>
2882
- </li>
2883
-
2884
- <li class="covered" data-hits="1" data-linenumber="72">
2885
- <span class="hits">1</span>
2886
-
2887
- <code class="ruby"> def method_missing(meth, *args, &amp;block)</code>
2888
- </li>
2889
-
2890
- <li class="never" data-hits="" data-linenumber="73">
2891
-
2892
-
2893
- <code class="ruby"></code>
2894
- </li>
2895
-
2896
- <li class="covered" data-hits="39" data-linenumber="74">
2897
- <span class="hits">39</span>
2898
-
2899
- <code class="ruby"> unless args.length &gt; 0 || block_given?</code>
2900
- </li>
2901
-
2902
- <li class="never" data-hits="" data-linenumber="75">
2903
-
2904
-
2905
- <code class="ruby"> raise Exception.new(</code>
2906
- </li>
2907
-
2908
- <li class="never" data-hits="" data-linenumber="76">
2909
-
2910
-
2911
- <code class="ruby"> &quot;Please provide either a String or a block to #{meth}&quot;</code>
2912
- </li>
2913
-
2914
- <li class="missed" data-hits="0" data-linenumber="77">
2915
-
2916
-
2917
- <code class="ruby"> )</code>
2918
- </li>
2919
-
2920
- <li class="never" data-hits="" data-linenumber="78">
2921
-
2922
-
2923
- <code class="ruby"> end</code>
2924
- </li>
2925
-
2926
- <li class="never" data-hits="" data-linenumber="79">
2927
-
2928
-
2929
- <code class="ruby"> # a second arg is the options hash</code>
2930
- </li>
2931
-
2932
- <li class="covered" data-hits="39" data-linenumber="80">
2933
- <span class="hits">39</span>
2934
-
2935
- <code class="ruby"> opts = args[1] || {}</code>
2936
- </li>
2937
-
2938
- <li class="never" data-hits="" data-linenumber="81">
2939
-
2940
-
2941
- <code class="ruby"> </code>
2942
- </li>
2943
-
2944
- <li class="never" data-hits="" data-linenumber="82">
2945
-
2946
-
2947
- <code class="ruby"> # the value is the first arg</code>
2948
- </li>
2949
-
2950
- <li class="covered" data-hits="39" data-linenumber="83">
2951
- <span class="hits">39</span>
2952
-
2953
- <code class="ruby"> value = args[0]</code>
2954
- </li>
2955
-
2956
- <li class="never" data-hits="" data-linenumber="84">
2957
-
2958
-
2959
- <code class="ruby"> </code>
2960
- </li>
2961
-
2962
- <li class="covered" data-hits="39" data-linenumber="85">
2963
- <span class="hits">39</span>
2964
-
2965
- <code class="ruby"> if opts[:optional]</code>
2966
- </li>
2967
-
2968
- <li class="covered" data-hits="3" data-linenumber="86">
2969
- <span class="hits">3</span>
2970
-
2971
- <code class="ruby"> @optional_attributes &lt;&lt; meth.to_sym</code>
2972
- </li>
2973
-
2974
- <li class="never" data-hits="" data-linenumber="87">
2975
-
2976
-
2977
- <code class="ruby"> end</code>
2978
- </li>
2979
-
2980
- <li class="never" data-hits="" data-linenumber="88">
2981
-
2982
-
2983
- <code class="ruby"></code>
2984
- </li>
2985
-
2986
- <li class="covered" data-hits="39" data-linenumber="89">
2987
- <span class="hits">39</span>
2988
-
2989
- <code class="ruby"> @attributes ||= Hash.new</code>
2990
- </li>
2991
-
2992
- <li class="never" data-hits="" data-linenumber="90">
2993
-
2994
-
2995
- <code class="ruby"> </code>
2996
- </li>
2997
-
2998
- <li class="covered" data-hits="39" data-linenumber="91">
2999
- <span class="hits">39</span>
3000
-
3001
- <code class="ruby"> if block_given?</code>
3002
- </li>
3003
-
3004
- <li class="covered" data-hits="5" data-linenumber="92">
3005
- <span class="hits">5</span>
3006
-
3007
- <code class="ruby"> @attributes[meth.to_sym] = block</code>
3008
- </li>
3009
-
3010
- <li class="never" data-hits="" data-linenumber="93">
3011
-
3012
-
3013
- <code class="ruby"> else</code>
3014
- </li>
3015
-
3016
- <li class="covered" data-hits="34" data-linenumber="94">
3017
- <span class="hits">34</span>
3018
-
3019
- <code class="ruby"> @attributes[meth.to_sym] = value</code>
3020
- </li>
3021
-
3022
- <li class="never" data-hits="" data-linenumber="95">
3023
-
3024
-
3025
- <code class="ruby"> end</code>
3026
- </li>
3027
-
3028
- <li class="never" data-hits="" data-linenumber="96">
3029
-
3030
-
3031
- <code class="ruby"> end</code>
3032
- </li>
3033
-
3034
- <li class="never" data-hits="" data-linenumber="97">
3035
-
3036
-
3037
- <code class="ruby">end</code>
3038
- </li>
3039
-
3040
- </ol>
3041
- </pre>
3042
- </div>
3043
-
3044
- <div class="source_table" id="4cc7721b735165eef9b1e5afd4a168c1a72d5103">
3045
- <div class="header">
3046
- <h3>lib/matcher.rb</h3>
3047
- <h4><span class="red">48.84 %</span> covered</h4>
3048
- <div>
3049
- <b>43</b> relevant lines.
3050
- <span class="green"><b>21</b> lines covered</span> and
3051
- <span class="red"><b>22</b> lines missed.</span>
3052
- </div>
3053
- </div>
3054
-
3055
- <pre>
3056
- <ol>
3057
-
3058
- <li class="never" data-hits="" data-linenumber="1">
3059
-
3060
-
3061
- <code class="ruby"># just in case it's not loaded</code>
3062
- </li>
3063
-
3064
- <li class="covered" data-hits="1" data-linenumber="2">
3065
- <span class="hits">1</span>
3066
-
3067
- <code class="ruby">require 'rspec'</code>
3068
- </li>
3069
-
3070
- <li class="covered" data-hits="1" data-linenumber="3">
3071
- <span class="hits">1</span>
3072
-
3073
- <code class="ruby">require 'pp'</code>
3074
- </li>
3075
-
3076
- <li class="never" data-hits="" data-linenumber="4">
3077
-
3078
-
3079
- <code class="ruby"></code>
3080
- </li>
3081
-
3082
- <li class="never" data-hits="" data-linenumber="5">
3083
-
3084
-
3085
- <code class="ruby"></code>
3086
- </li>
3087
-
3088
- <li class="covered" data-hits="1" data-linenumber="6">
3089
- <span class="hits">1</span>
3090
-
3091
- <code class="ruby">def print_diff(diff, depth = 1)</code>
3092
- </li>
3093
-
3094
- <li class="missed" data-hits="0" data-linenumber="7">
3095
-
3096
-
3097
- <code class="ruby"> puts &quot;#{&quot;\t&quot; * depth}&quot; + &quot;HashDealer::#{diff.first.to_s}&quot;.bold.cyan + &quot;\t\t\t\tResponse::#{diff.last.to_s}&quot;.bold.yellow if diff.is_a?(Array)</code>
3098
- </li>
3099
-
3100
- <li class="missed" data-hits="0" data-linenumber="8">
3101
-
3102
-
3103
- <code class="ruby"> if diff.is_a?(Hash)</code>
3104
- </li>
3105
-
3106
- <li class="missed" data-hits="0" data-linenumber="9">
3107
-
3108
-
3109
- <code class="ruby"> diff.each_pair do |k, v|</code>
3110
- </li>
3111
-
3112
- <li class="missed" data-hits="0" data-linenumber="10">
3113
-
3114
-
3115
- <code class="ruby"> puts &quot;\n&quot;</code>
3116
- </li>
3117
-
3118
- <li class="missed" data-hits="0" data-linenumber="11">
3119
-
3120
-
3121
- <code class="ruby"> puts ((&quot;\t&quot; * depth) + k.to_s).red</code>
3122
- </li>
3123
-
3124
- <li class="missed" data-hits="0" data-linenumber="12">
3125
-
3126
-
3127
- <code class="ruby"> print_diff(v, depth + 1)</code>
3128
- </li>
3129
-
3130
- <li class="never" data-hits="" data-linenumber="13">
3131
-
3132
-
3133
- <code class="ruby"> end</code>
3134
- </li>
3135
-
3136
- <li class="never" data-hits="" data-linenumber="14">
3137
-
3138
-
3139
- <code class="ruby"> end</code>
3140
- </li>
3141
-
3142
- <li class="never" data-hits="" data-linenumber="15">
3143
-
3144
-
3145
- <code class="ruby">end</code>
3146
- </li>
3147
-
3148
- <li class="never" data-hits="" data-linenumber="16">
3149
-
3150
-
3151
- <code class="ruby"></code>
3152
- </li>
3153
-
3154
- <li class="covered" data-hits="1" data-linenumber="17">
3155
- <span class="hits">1</span>
3156
-
3157
- <code class="ruby">RSpec::Matchers.define(:match_response) do |actual|</code>
3158
- </li>
3159
-
3160
- <li class="covered" data-hits="13" data-linenumber="18">
3161
- <span class="hits">13</span>
3162
-
3163
- <code class="ruby"> actual = Comparator.normalize_value(actual)</code>
3164
- </li>
3165
-
3166
- <li class="never" data-hits="" data-linenumber="19">
3167
-
3168
-
3169
- <code class="ruby"> </code>
3170
- </li>
3171
-
3172
- <li class="covered" data-hits="13" data-linenumber="20">
3173
- <span class="hits">13</span>
3174
-
3175
- <code class="ruby"> match do |expected|</code>
3176
- </li>
3177
-
3178
- <li class="covered" data-hits="13" data-linenumber="21">
3179
- <span class="hits">13</span>
3180
-
3181
- <code class="ruby"> expected = Comparator.normalize_value(expected)</code>
3182
- </li>
3183
-
3184
- <li class="covered" data-hits="13" data-linenumber="22">
3185
- <span class="hits">13</span>
3186
-
3187
- <code class="ruby"> @diff = Comparator.diff(actual, expected)</code>
3188
- </li>
3189
-
3190
- <li class="covered" data-hits="13" data-linenumber="23">
3191
- <span class="hits">13</span>
3192
-
3193
- <code class="ruby"> @diff == {}</code>
3194
- </li>
3195
-
3196
- <li class="never" data-hits="" data-linenumber="24">
3197
-
3198
-
3199
- <code class="ruby"> end</code>
3200
- </li>
3201
-
3202
- <li class="never" data-hits="" data-linenumber="25">
3203
-
3204
-
3205
- <code class="ruby"> </code>
3206
- </li>
3207
-
3208
- <li class="covered" data-hits="13" data-linenumber="26">
3209
- <span class="hits">13</span>
3210
-
3211
- <code class="ruby"> failure_message_for_should do |container|</code>
3212
- </li>
3213
-
3214
- <li class="missed" data-hits="0" data-linenumber="27">
3215
-
3216
-
3217
- <code class="ruby"> puts &quot;\n&quot;</code>
3218
- </li>
3219
-
3220
- <li class="missed" data-hits="0" data-linenumber="28">
3221
-
3222
-
3223
- <code class="ruby"> print_diff(@diff)</code>
3224
- </li>
3225
-
3226
- <li class="missed" data-hits="0" data-linenumber="29">
3227
-
3228
-
3229
- <code class="ruby"> puts &quot;\n&quot;</code>
3230
- </li>
3231
-
3232
- <li class="missed" data-hits="0" data-linenumber="30">
3233
-
3234
-
3235
- <code class="ruby"> &quot;&quot;</code>
3236
- </li>
3237
-
3238
- <li class="never" data-hits="" data-linenumber="31">
3239
-
3240
-
3241
- <code class="ruby"> end</code>
3242
- </li>
3243
-
3244
- <li class="never" data-hits="" data-linenumber="32">
3245
-
3246
-
3247
- <code class="ruby"> </code>
3248
- </li>
3249
-
3250
- <li class="covered" data-hits="13" data-linenumber="33">
3251
- <span class="hits">13</span>
3252
-
3253
- <code class="ruby"> failure_message_for_should_not do |container|</code>
3254
- </li>
3255
-
3256
- <li class="missed" data-hits="0" data-linenumber="34">
3257
-
3258
-
3259
- <code class="ruby"> puts &quot;\n&quot;</code>
3260
- </li>
3261
-
3262
- <li class="missed" data-hits="0" data-linenumber="35">
3263
-
3264
-
3265
- <code class="ruby"> print_diff(@diff)</code>
3266
- </li>
3267
-
3268
- <li class="missed" data-hits="0" data-linenumber="36">
3269
-
3270
-
3271
- <code class="ruby"> puts &quot;\n&quot;</code>
3272
- </li>
3273
-
3274
- <li class="missed" data-hits="0" data-linenumber="37">
3275
-
3276
-
3277
- <code class="ruby"> &quot;&quot;</code>
3278
- </li>
3279
-
3280
- <li class="never" data-hits="" data-linenumber="38">
3281
-
3282
-
3283
- <code class="ruby"> end</code>
3284
- </li>
3285
-
3286
- <li class="never" data-hits="" data-linenumber="39">
3287
-
3288
-
3289
- <code class="ruby">end</code>
3290
- </li>
3291
-
3292
- <li class="never" data-hits="" data-linenumber="40">
3293
-
3294
-
3295
- <code class="ruby"></code>
3296
- </li>
3297
-
3298
- <li class="never" data-hits="" data-linenumber="41">
3299
-
3300
-
3301
- <code class="ruby"># alias as match_json</code>
3302
- </li>
3303
-
3304
- <li class="covered" data-hits="1" data-linenumber="42">
3305
- <span class="hits">1</span>
3306
-
3307
- <code class="ruby">RSpec::Matchers.define(:match_list) do |actual|</code>
3308
- </li>
3309
-
3310
- <li class="never" data-hits="" data-linenumber="43">
3311
-
3312
-
3313
- <code class="ruby"> </code>
3314
- </li>
3315
-
3316
- <li class="covered" data-hits="2" data-linenumber="44">
3317
- <span class="hits">2</span>
3318
-
3319
- <code class="ruby"> actual = Comparator.normalize_value(actual)</code>
3320
- </li>
3321
-
3322
- <li class="never" data-hits="" data-linenumber="45">
3323
-
3324
-
3325
- <code class="ruby"> </code>
3326
- </li>
3327
-
3328
- <li class="covered" data-hits="2" data-linenumber="46">
3329
- <span class="hits">2</span>
3330
-
3331
- <code class="ruby"> match do |expected|</code>
3332
- </li>
3333
-
3334
- <li class="covered" data-hits="2" data-linenumber="47">
3335
- <span class="hits">2</span>
3336
-
3337
- <code class="ruby"> expected = Comparator.normalize_value(expected)</code>
3338
- </li>
3339
-
3340
- <li class="covered" data-hits="2" data-linenumber="48">
3341
- <span class="hits">2</span>
3342
-
3343
- <code class="ruby"> expected = expected.first if expected.is_a?(Array)</code>
3344
- </li>
3345
-
3346
- <li class="covered" data-hits="2" data-linenumber="49">
3347
- <span class="hits">2</span>
3348
-
3349
- <code class="ruby"> actual = actual.first if actual.is_a?(Array)</code>
3350
- </li>
3351
-
3352
- <li class="covered" data-hits="2" data-linenumber="50">
3353
- <span class="hits">2</span>
3354
-
3355
- <code class="ruby"> @diff = Comparator.diff(actual, expected)</code>
3356
- </li>
3357
-
3358
- <li class="covered" data-hits="2" data-linenumber="51">
3359
- <span class="hits">2</span>
3360
-
3361
- <code class="ruby"> @diff == {}</code>
3362
- </li>
3363
-
3364
- <li class="never" data-hits="" data-linenumber="52">
3365
-
3366
-
3367
- <code class="ruby"> end</code>
3368
- </li>
3369
-
3370
- <li class="never" data-hits="" data-linenumber="53">
3371
-
3372
-
3373
- <code class="ruby"> </code>
3374
- </li>
3375
-
3376
- <li class="covered" data-hits="2" data-linenumber="54">
3377
- <span class="hits">2</span>
3378
-
3379
- <code class="ruby"> failure_message_for_should do |container|</code>
3380
- </li>
3381
-
3382
- <li class="missed" data-hits="0" data-linenumber="55">
3383
-
3384
-
3385
- <code class="ruby"> puts &quot;\n&quot;</code>
3386
- </li>
3387
-
3388
- <li class="missed" data-hits="0" data-linenumber="56">
3389
-
3390
-
3391
- <code class="ruby"> print_diff(@diff)</code>
3392
- </li>
3393
-
3394
- <li class="missed" data-hits="0" data-linenumber="57">
3395
-
3396
-
3397
- <code class="ruby"> puts &quot;\n&quot;</code>
3398
- </li>
3399
-
3400
- <li class="missed" data-hits="0" data-linenumber="58">
3401
-
3402
-
3403
- <code class="ruby"> &quot;&quot;</code>
3404
- </li>
3405
-
3406
- <li class="never" data-hits="" data-linenumber="59">
3407
-
3408
-
3409
- <code class="ruby"> end</code>
3410
- </li>
3411
-
3412
- <li class="never" data-hits="" data-linenumber="60">
3413
-
3414
-
3415
- <code class="ruby"> </code>
3416
- </li>
3417
-
3418
- <li class="covered" data-hits="2" data-linenumber="61">
3419
- <span class="hits">2</span>
3420
-
3421
- <code class="ruby"> failure_message_for_should_not do |container|</code>
3422
- </li>
3423
-
3424
- <li class="missed" data-hits="0" data-linenumber="62">
3425
-
3426
-
3427
- <code class="ruby"> puts &quot;\n&quot;</code>
3428
- </li>
3429
-
3430
- <li class="missed" data-hits="0" data-linenumber="63">
3431
-
3432
-
3433
- <code class="ruby"> print_diff(@diff)</code>
3434
- </li>
3435
-
3436
- <li class="missed" data-hits="0" data-linenumber="64">
3437
-
3438
-
3439
- <code class="ruby"> puts &quot;\n&quot;</code>
3440
- </li>
3441
-
3442
- <li class="missed" data-hits="0" data-linenumber="65">
3443
-
3444
-
3445
- <code class="ruby"> &quot;&quot;</code>
3446
- </li>
3447
-
3448
- <li class="never" data-hits="" data-linenumber="66">
3449
-
3450
-
3451
- <code class="ruby"> end</code>
3452
- </li>
3453
-
3454
- <li class="never" data-hits="" data-linenumber="67">
3455
-
3456
-
3457
- <code class="ruby"> </code>
3458
- </li>
3459
-
3460
- <li class="never" data-hits="" data-linenumber="68">
3461
-
3462
-
3463
- <code class="ruby">end</code>
3464
- </li>
3465
-
3466
- </ol>
3467
- </pre>
3468
- </div>
3469
-
3470
- <div class="source_table" id="a262d63e5dc399019853b13f0e4b947eb9908f86">
3471
- <div class="header">
3472
- <h3>lib/path_string.rb</h3>
3473
- <h4><span class="red">69.57 %</span> covered</h4>
3474
- <div>
3475
- <b>69</b> relevant lines.
3476
- <span class="green"><b>48</b> lines covered</span> and
3477
- <span class="red"><b>21</b> lines missed.</span>
3478
- </div>
3479
- </div>
3480
-
3481
- <pre>
3482
- <ol>
3483
-
3484
- <li class="covered" data-hits="1" data-linenumber="1">
3485
- <span class="hits">1</span>
3486
-
3487
- <code class="ruby">require &quot;active_support&quot;</code>
3488
- </li>
3489
-
3490
- <li class="never" data-hits="" data-linenumber="2">
3491
-
3492
-
3493
- <code class="ruby"></code>
3494
- </li>
3495
-
3496
- <li class="covered" data-hits="1" data-linenumber="3">
3497
- <span class="hits">1</span>
3498
-
3499
- <code class="ruby">class PathString &lt; String</code>
3500
- </li>
3501
-
3502
- <li class="never" data-hits="" data-linenumber="4">
3503
-
3504
-
3505
- <code class="ruby"> </code>
3506
- </li>
3507
-
3508
- <li class="covered" data-hits="1" data-linenumber="5">
3509
- <span class="hits">1</span>
3510
-
3511
- <code class="ruby"> def == (other)</code>
3512
- </li>
3513
-
3514
- <li class="never" data-hits="" data-linenumber="6">
3515
-
3516
-
3517
- <code class="ruby"> # if either is a string that starts with a :, return true</code>
3518
- </li>
3519
-
3520
- <li class="covered" data-hits="57" data-linenumber="7">
3521
- <span class="hits">57</span>
3522
-
3523
- <code class="ruby"> if self =~ /^:/ || (other.is_a?(Numeric) &amp;&amp; self =~ /^:\d+$/) || other =~ /^:/</code>
3524
- </li>
3525
-
3526
- <li class="covered" data-hits="37" data-linenumber="8">
3527
- <span class="hits">37</span>
3528
-
3529
- <code class="ruby"> return true</code>
3530
- </li>
3531
-
3532
- <li class="covered" data-hits="20" data-linenumber="9">
3533
- <span class="hits">20</span>
3534
-
3535
- <code class="ruby"> elsif self =~ /\/:/ || other =~ /\/:/</code>
3536
- </li>
3537
-
3538
- <li class="covered" data-hits="1" data-linenumber="10">
3539
- <span class="hits">1</span>
3540
-
3541
- <code class="ruby"> return self.class.paths_match?(self, other)</code>
3542
- </li>
3543
-
3544
- <li class="never" data-hits="" data-linenumber="11">
3545
-
3546
-
3547
- <code class="ruby"> else</code>
3548
- </li>
3549
-
3550
- <li class="covered" data-hits="19" data-linenumber="12">
3551
- <span class="hits">19</span>
3552
-
3553
- <code class="ruby"> super</code>
3554
- </li>
3555
-
3556
- <li class="never" data-hits="" data-linenumber="13">
3557
-
3558
-
3559
- <code class="ruby"> end</code>
3560
- </li>
3561
-
3562
- <li class="never" data-hits="" data-linenumber="14">
3563
-
3564
-
3565
- <code class="ruby"> end</code>
3566
- </li>
3567
-
3568
- <li class="covered" data-hits="1" data-linenumber="15">
3569
- <span class="hits">1</span>
3570
-
3571
- <code class="ruby"> alias_method :eql?, :==</code>
3572
- </li>
3573
-
3574
- <li class="never" data-hits="" data-linenumber="16">
3575
-
3576
-
3577
- <code class="ruby"> </code>
3578
- </li>
3579
-
3580
- <li class="covered" data-hits="1" data-linenumber="17">
3581
- <span class="hits">1</span>
3582
-
3583
- <code class="ruby"> def self.paths_match?(a, b)</code>
3584
- </li>
3585
-
3586
- <li class="covered" data-hits="2" data-linenumber="18">
3587
- <span class="hits">2</span>
3588
-
3589
- <code class="ruby"> self.get_zipped_array(a, b).each do |kp, ep|</code>
3590
- </li>
3591
-
3592
- <li class="never" data-hits="" data-linenumber="19">
3593
-
3594
-
3595
- <code class="ruby"> # only known path can have things prefixed with colons which is protected</code>
3596
- </li>
3597
-
3598
- <li class="covered" data-hits="6" data-linenumber="20">
3599
- <span class="hits">6</span>
3600
-
3601
- <code class="ruby"> if kp.nil? || ep.nil?</code>
3602
- </li>
3603
-
3604
- <li class="missed" data-hits="0" data-linenumber="21">
3605
-
3606
-
3607
- <code class="ruby"> return false</code>
3608
- </li>
3609
-
3610
- <li class="never" data-hits="" data-linenumber="22">
3611
-
3612
-
3613
- <code class="ruby"> elsif String.new(kp) != String.new(ep) &amp;&amp; !kp.start_with?(&quot;:&quot;) &amp;&amp; !ep.start_with?(&quot;:&quot;)</code>
3614
- </li>
3615
-
3616
- <li class="missed" data-hits="0" data-linenumber="23">
3617
-
3618
-
3619
- <code class="ruby"> return false</code>
3620
- </li>
3621
-
3622
- <li class="never" data-hits="" data-linenumber="24">
3623
-
3624
-
3625
- <code class="ruby"> end</code>
3626
- </li>
3627
-
3628
- <li class="never" data-hits="" data-linenumber="25">
3629
-
3630
-
3631
- <code class="ruby"> end</code>
3632
- </li>
3633
-
3634
- <li class="covered" data-hits="2" data-linenumber="26">
3635
- <span class="hits">2</span>
3636
-
3637
- <code class="ruby"> return true</code>
3638
- </li>
3639
-
3640
- <li class="never" data-hits="" data-linenumber="27">
3641
-
3642
-
3643
- <code class="ruby"> end</code>
3644
- </li>
3645
-
3646
- <li class="never" data-hits="" data-linenumber="28">
3647
-
3648
-
3649
- <code class="ruby"> </code>
3650
- </li>
3651
-
3652
- <li class="covered" data-hits="1" data-linenumber="29">
3653
- <span class="hits">1</span>
3654
-
3655
- <code class="ruby"> def self.as_sorted_json(val)</code>
3656
- </li>
3657
-
3658
- <li class="covered" data-hits="6" data-linenumber="30">
3659
- <span class="hits">6</span>
3660
-
3661
- <code class="ruby"> val = self.sort_json(val)</code>
3662
- </li>
3663
-
3664
- <li class="covered" data-hits="6" data-linenumber="31">
3665
- <span class="hits">6</span>
3666
-
3667
- <code class="ruby"> val = val.pathify_strings</code>
3668
- </li>
3669
-
3670
- <li class="covered" data-hits="6" data-linenumber="32">
3671
- <span class="hits">6</span>
3672
-
3673
- <code class="ruby"> val</code>
3674
- </li>
3675
-
3676
- <li class="never" data-hits="" data-linenumber="33">
3677
-
3678
-
3679
- <code class="ruby"> end</code>
3680
- </li>
3681
-
3682
- <li class="never" data-hits="" data-linenumber="34">
3683
-
3684
-
3685
- <code class="ruby"> </code>
3686
- </li>
3687
-
3688
- <li class="never" data-hits="" data-linenumber="35">
3689
-
3690
-
3691
- <code class="ruby"> # helper method to be called recursively</code>
3692
- </li>
3693
-
3694
- <li class="covered" data-hits="1" data-linenumber="36">
3695
- <span class="hits">1</span>
3696
-
3697
- <code class="ruby"> def self.sort_json(val)</code>
3698
- </li>
3699
-
3700
- <li class="covered" data-hits="8" data-linenumber="37">
3701
- <span class="hits">8</span>
3702
-
3703
- <code class="ruby"> return val if val.is_a?(TimeDateMatcher)</code>
3704
- </li>
3705
-
3706
- <li class="covered" data-hits="8" data-linenumber="38">
3707
- <span class="hits">8</span>
3708
-
3709
- <code class="ruby"> val = ActiveSupport::JSON.decode(val) if val.is_a?(String)</code>
3710
- </li>
3711
-
3712
- <li class="covered" data-hits="8" data-linenumber="39">
3713
- <span class="hits">8</span>
3714
-
3715
- <code class="ruby"> val = self.stringify_keys(val).sort if val.is_a?(Hash)</code>
3716
- </li>
3717
-
3718
- <li class="covered" data-hits="104" data-linenumber="40">
3719
- <span class="hits">104</span>
3720
-
3721
- <code class="ruby"> val = val.collect{|v| v.collect{|n| n.is_a?(Hash) ? self.sort_json(n) : n}} if val.is_a?(Array)</code>
3722
- </li>
3723
-
3724
- <li class="covered" data-hits="8" data-linenumber="41">
3725
- <span class="hits">8</span>
3726
-
3727
- <code class="ruby"> val.sort</code>
3728
- </li>
3729
-
3730
- <li class="never" data-hits="" data-linenumber="42">
3731
-
3732
-
3733
- <code class="ruby"> end</code>
3734
- </li>
3735
-
3736
- <li class="never" data-hits="" data-linenumber="43">
3737
-
3738
-
3739
- <code class="ruby"> </code>
3740
- </li>
3741
-
3742
- <li class="never" data-hits="" data-linenumber="44">
3743
-
3744
-
3745
- <code class="ruby"> # </code>
3746
- </li>
3747
-
3748
- <li class="never" data-hits="" data-linenumber="45">
3749
-
3750
-
3751
- <code class="ruby"> # </code>
3752
- </li>
3753
-
3754
- <li class="covered" data-hits="1" data-linenumber="46">
3755
- <span class="hits">1</span>
3756
-
3757
- <code class="ruby"> def self.extract_params(known_path, entered_path)</code>
3758
- </li>
3759
-
3760
- <li class="missed" data-hits="0" data-linenumber="47">
3761
-
3762
-
3763
- <code class="ruby"> params = {}.with_indifferent_access</code>
3764
- </li>
3765
-
3766
- <li class="never" data-hits="" data-linenumber="48">
3767
-
3768
-
3769
- <code class="ruby"> </code>
3770
- </li>
3771
-
3772
- <li class="missed" data-hits="0" data-linenumber="49">
3773
-
3774
-
3775
- <code class="ruby"> self.get_zipped_array(known_path, entered_path).each do |kp, ep|</code>
3776
- </li>
3777
-
3778
- <li class="missed" data-hits="0" data-linenumber="50">
3779
-
3780
-
3781
- <code class="ruby"> if kp.nil? || ep.nil?</code>
3782
- </li>
3783
-
3784
- <li class="missed" data-hits="0" data-linenumber="51">
3785
-
3786
-
3787
- <code class="ruby"> raise Exception.new(&quot;Cannot extract params for routes that don't match&quot;)</code>
3788
- </li>
3789
-
3790
- <li class="never" data-hits="" data-linenumber="52">
3791
-
3792
-
3793
- <code class="ruby"> end</code>
3794
- </li>
3795
-
3796
- <li class="missed" data-hits="0" data-linenumber="53">
3797
-
3798
-
3799
- <code class="ruby"> if kp.start_with?(&quot;:&quot;)</code>
3800
- </li>
3801
-
3802
- <li class="missed" data-hits="0" data-linenumber="54">
3803
-
3804
-
3805
- <code class="ruby"> if params[kp[1..-1]]</code>
3806
- </li>
3807
-
3808
- <li class="missed" data-hits="0" data-linenumber="55">
3809
-
3810
-
3811
- <code class="ruby"> raise Exception.new(&quot;Cannot define a route containing two parameters with the same name&quot;)</code>
3812
- </li>
3813
-
3814
- <li class="never" data-hits="" data-linenumber="56">
3815
-
3816
-
3817
- <code class="ruby"> else</code>
3818
- </li>
3819
-
3820
- <li class="missed" data-hits="0" data-linenumber="57">
3821
-
3822
-
3823
- <code class="ruby"> params[kp[1..-1]] = ep</code>
3824
- </li>
3825
-
3826
- <li class="never" data-hits="" data-linenumber="58">
3827
-
3828
-
3829
- <code class="ruby"> end</code>
3830
- </li>
3831
-
3832
- <li class="never" data-hits="" data-linenumber="59">
3833
-
3834
-
3835
- <code class="ruby"> end</code>
3836
- </li>
3837
-
3838
- <li class="never" data-hits="" data-linenumber="60">
3839
-
3840
-
3841
- <code class="ruby"> end</code>
3842
- </li>
3843
-
3844
- <li class="missed" data-hits="0" data-linenumber="61">
3845
-
3846
-
3847
- <code class="ruby"> return params</code>
3848
- </li>
3849
-
3850
- <li class="never" data-hits="" data-linenumber="62">
3851
-
3852
-
3853
- <code class="ruby"> end</code>
3854
- </li>
3855
-
3856
- <li class="never" data-hits="" data-linenumber="63">
3857
-
3858
-
3859
- <code class="ruby"> </code>
3860
- </li>
3861
-
3862
- <li class="covered" data-hits="1" data-linenumber="64">
3863
- <span class="hits">1</span>
3864
-
3865
- <code class="ruby"> def self.diff(a,b)</code>
3866
- </li>
3867
-
3868
- <li class="missed" data-hits="0" data-linenumber="65">
3869
-
3870
-
3871
- <code class="ruby"> a, b = self.as_sorted_json(a), self.as_sorted_json(b)</code>
3872
- </li>
3873
-
3874
- <li class="missed" data-hits="0" data-linenumber="66">
3875
-
3876
-
3877
- <code class="ruby"> diff = []</code>
3878
- </li>
3879
-
3880
- <li class="missed" data-hits="0" data-linenumber="67">
3881
-
3882
-
3883
- <code class="ruby"> a.each_index do |i|</code>
3884
- </li>
3885
-
3886
- <li class="missed" data-hits="0" data-linenumber="68">
3887
-
3888
-
3889
- <code class="ruby"> unless a[i] == b[i]</code>
3890
- </li>
3891
-
3892
- <li class="missed" data-hits="0" data-linenumber="69">
3893
-
3894
-
3895
- <code class="ruby"> diff &lt;&lt; {:expected =&gt; a[i], :got =&gt; b[i]}</code>
3896
- </li>
3897
-
3898
- <li class="never" data-hits="" data-linenumber="70">
3899
-
3900
-
3901
- <code class="ruby"> end</code>
3902
- </li>
3903
-
3904
- <li class="never" data-hits="" data-linenumber="71">
3905
-
3906
-
3907
- <code class="ruby"> end</code>
3908
- </li>
3909
-
3910
- <li class="missed" data-hits="0" data-linenumber="72">
3911
-
3912
-
3913
- <code class="ruby"> diff</code>
3914
- </li>
3915
-
3916
- <li class="never" data-hits="" data-linenumber="73">
3917
-
3918
-
3919
- <code class="ruby"> end</code>
3920
- </li>
3921
-
3922
- <li class="never" data-hits="" data-linenumber="74">
3923
-
3924
-
3925
- <code class="ruby"> </code>
3926
- </li>
3927
-
3928
- <li class="never" data-hits="" data-linenumber="75">
3929
-
3930
-
3931
- <code class="ruby"> </code>
3932
- </li>
3933
-
3934
- <li class="covered" data-hits="1" data-linenumber="76">
3935
- <span class="hits">1</span>
3936
-
3937
- <code class="ruby"> private</code>
3938
- </li>
3939
-
3940
- <li class="never" data-hits="" data-linenumber="77">
3941
-
3942
-
3943
- <code class="ruby"> </code>
3944
- </li>
3945
-
3946
- <li class="covered" data-hits="1" data-linenumber="78">
3947
- <span class="hits">1</span>
3948
-
3949
- <code class="ruby"> def self.stringify_keys(hash)</code>
3950
- </li>
3951
-
3952
- <li class="covered" data-hits="8" data-linenumber="79">
3953
- <span class="hits">8</span>
3954
-
3955
- <code class="ruby"> new_hash = hash.class.new</code>
3956
- </li>
3957
-
3958
- <li class="covered" data-hits="8" data-linenumber="80">
3959
- <span class="hits">8</span>
3960
-
3961
- <code class="ruby"> hash.each_pair do |k,v|</code>
3962
- </li>
3963
-
3964
- <li class="covered" data-hits="36" data-linenumber="81">
3965
- <span class="hits">36</span>
3966
-
3967
- <code class="ruby"> new_hash[k.to_s] = case v</code>
3968
- </li>
3969
-
3970
- <li class="never" data-hits="" data-linenumber="82">
3971
-
3972
-
3973
- <code class="ruby"> when Hash</code>
3974
- </li>
3975
-
3976
- <li class="covered" data-hits="1" data-linenumber="83">
3977
- <span class="hits">1</span>
3978
-
3979
- <code class="ruby"> self.stringify_keys(v)</code>
3980
- </li>
3981
-
3982
- <li class="never" data-hits="" data-linenumber="84">
3983
-
3984
-
3985
- <code class="ruby"> when Array</code>
3986
- </li>
3987
-
3988
- <li class="covered" data-hits="4" data-linenumber="85">
3989
- <span class="hits">4</span>
3990
-
3991
- <code class="ruby"> self.stringify_array_keys(v)</code>
3992
- </li>
3993
-
3994
- <li class="never" data-hits="" data-linenumber="86">
3995
-
3996
-
3997
- <code class="ruby"> else</code>
3998
- </li>
3999
-
4000
- <li class="covered" data-hits="31" data-linenumber="87">
4001
- <span class="hits">31</span>
4002
-
4003
- <code class="ruby"> v </code>
4004
- </li>
4005
-
4006
- <li class="never" data-hits="" data-linenumber="88">
4007
-
4008
-
4009
- <code class="ruby"> end</code>
4010
- </li>
4011
-
4012
- <li class="never" data-hits="" data-linenumber="89">
4013
-
4014
-
4015
- <code class="ruby"> end</code>
4016
- </li>
4017
-
4018
- <li class="covered" data-hits="8" data-linenumber="90">
4019
- <span class="hits">8</span>
4020
-
4021
- <code class="ruby"> new_hash</code>
4022
- </li>
4023
-
4024
- <li class="never" data-hits="" data-linenumber="91">
4025
-
4026
-
4027
- <code class="ruby"> end</code>
4028
- </li>
4029
-
4030
- <li class="never" data-hits="" data-linenumber="92">
4031
-
4032
-
4033
- <code class="ruby"> </code>
4034
- </li>
4035
-
4036
- <li class="never" data-hits="" data-linenumber="93">
4037
-
4038
-
4039
- <code class="ruby"> # </code>
4040
- </li>
4041
-
4042
- <li class="covered" data-hits="1" data-linenumber="94">
4043
- <span class="hits">1</span>
4044
-
4045
- <code class="ruby"> def self.stringify_array_keys(array)</code>
4046
- </li>
4047
-
4048
- <li class="covered" data-hits="4" data-linenumber="95">
4049
- <span class="hits">4</span>
4050
-
4051
- <code class="ruby"> array.collect{|v|</code>
4052
- </li>
4053
-
4054
- <li class="covered" data-hits="8" data-linenumber="96">
4055
- <span class="hits">8</span>
4056
-
4057
- <code class="ruby"> case v</code>
4058
- </li>
4059
-
4060
- <li class="never" data-hits="" data-linenumber="97">
4061
-
4062
-
4063
- <code class="ruby"> when Hash</code>
4064
- </li>
4065
-
4066
- <li class="missed" data-hits="0" data-linenumber="98">
4067
-
4068
-
4069
- <code class="ruby"> self.stringify_keys(v)</code>
4070
- </li>
4071
-
4072
- <li class="never" data-hits="" data-linenumber="99">
4073
-
4074
-
4075
- <code class="ruby"> when Array</code>
4076
- </li>
4077
-
4078
- <li class="missed" data-hits="0" data-linenumber="100">
4079
-
4080
-
4081
- <code class="ruby"> self.stringify_array_keys(v)</code>
4082
- </li>
4083
-
4084
- <li class="never" data-hits="" data-linenumber="101">
4085
-
4086
-
4087
- <code class="ruby"> else</code>
4088
- </li>
4089
-
4090
- <li class="covered" data-hits="8" data-linenumber="102">
4091
- <span class="hits">8</span>
4092
-
4093
- <code class="ruby"> v</code>
4094
- </li>
4095
-
4096
- <li class="never" data-hits="" data-linenumber="103">
4097
-
4098
-
4099
- <code class="ruby"> end</code>
4100
- </li>
4101
-
4102
- <li class="never" data-hits="" data-linenumber="104">
4103
-
4104
-
4105
- <code class="ruby"> }</code>
4106
- </li>
4107
-
4108
- <li class="never" data-hits="" data-linenumber="105">
4109
-
4110
-
4111
- <code class="ruby"> end</code>
4112
- </li>
4113
-
4114
- <li class="never" data-hits="" data-linenumber="106">
4115
-
4116
-
4117
- <code class="ruby"> </code>
4118
- </li>
4119
-
4120
- <li class="covered" data-hits="1" data-linenumber="107">
4121
- <span class="hits">1</span>
4122
-
4123
- <code class="ruby"> def self.get_zipped_array(known_path, entered_path)</code>
4124
- </li>
4125
-
4126
- <li class="never" data-hits="" data-linenumber="108">
4127
-
4128
-
4129
- <code class="ruby"> # make these strings</code>
4130
- </li>
4131
-
4132
- <li class="covered" data-hits="2" data-linenumber="109">
4133
- <span class="hits">2</span>
4134
-
4135
- <code class="ruby"> known_path, entered_path = known_path.to_s, entered_path.to_s</code>
4136
- </li>
4137
-
4138
- <li class="never" data-hits="" data-linenumber="110">
4139
-
4140
-
4141
- <code class="ruby"> # Remove the any beginning or trailing slashes from both paths if they exist</code>
4142
- </li>
4143
-
4144
- <li class="covered" data-hits="2" data-linenumber="111">
4145
- <span class="hits">2</span>
4146
-
4147
- <code class="ruby"> known_path = known_path[1..-1] if known_path.start_with?(&quot;/&quot;)</code>
4148
- </li>
4149
-
4150
- <li class="covered" data-hits="2" data-linenumber="112">
4151
- <span class="hits">2</span>
4152
-
4153
- <code class="ruby"> known_path = known_path[0..-2] if known_path.end_with?(&quot;/&quot;)</code>
4154
- </li>
4155
-
4156
- <li class="covered" data-hits="2" data-linenumber="113">
4157
- <span class="hits">2</span>
4158
-
4159
- <code class="ruby"> entered_path = entered_path[1..-1] if entered_path.start_with?(&quot;/&quot;)</code>
4160
- </li>
4161
-
4162
- <li class="covered" data-hits="2" data-linenumber="114">
4163
- <span class="hits">2</span>
4164
-
4165
- <code class="ruby"> entered_path = entered_path[0..-2] if entered_path.end_with?(&quot;/&quot;)</code>
4166
- </li>
4167
-
4168
- <li class="covered" data-hits="2" data-linenumber="115">
4169
- <span class="hits">2</span>
4170
-
4171
- <code class="ruby"> known_path = known_path.split(&quot;/&quot;)</code>
4172
- </li>
4173
-
4174
- <li class="covered" data-hits="2" data-linenumber="116">
4175
- <span class="hits">2</span>
4176
-
4177
- <code class="ruby"> entered_path = entered_path.split(&quot;/&quot;)</code>
4178
- </li>
4179
-
4180
- <li class="covered" data-hits="2" data-linenumber="117">
4181
- <span class="hits">2</span>
4182
-
4183
- <code class="ruby"> if known_path.length &lt; entered_path.length</code>
4184
- </li>
4185
-
4186
- <li class="missed" data-hits="0" data-linenumber="118">
4187
-
4188
-
4189
- <code class="ruby"> (entered_path.length - known_path.length).times do</code>
4190
- </li>
4191
-
4192
- <li class="missed" data-hits="0" data-linenumber="119">
4193
-
4194
-
4195
- <code class="ruby"> known_path &lt;&lt; nil</code>
4196
- </li>
4197
-
4198
- <li class="never" data-hits="" data-linenumber="120">
4199
-
4200
-
4201
- <code class="ruby"> end</code>
4202
- </li>
4203
-
4204
- <li class="never" data-hits="" data-linenumber="121">
4205
-
4206
-
4207
- <code class="ruby"> end</code>
4208
- </li>
4209
-
4210
- <li class="covered" data-hits="2" data-linenumber="122">
4211
- <span class="hits">2</span>
4212
-
4213
- <code class="ruby"> return known_path.zip(entered_path)</code>
4214
- </li>
4215
-
4216
- <li class="never" data-hits="" data-linenumber="123">
4217
-
4218
-
4219
- <code class="ruby"> end</code>
4220
- </li>
4221
-
4222
- <li class="never" data-hits="" data-linenumber="124">
4223
-
4224
-
4225
- <code class="ruby"> </code>
4226
- </li>
4227
-
4228
- <li class="never" data-hits="" data-linenumber="125">
4229
-
4230
-
4231
- <code class="ruby">end</code>
4232
- </li>
4233
-
4234
- </ol>
4235
- </pre>
4236
- </div>
4237
-
4238
- <div class="source_table" id="a53828a5413df9e3a1d0192504eac81ee4166020">
4239
- <div class="header">
4240
- <h3>lib/variable_array.rb</h3>
4241
- <h4><span class="green">90.91 %</span> covered</h4>
4242
- <div>
4243
- <b>11</b> relevant lines.
4244
- <span class="green"><b>10</b> lines covered</span> and
4245
- <span class="red"><b>1</b> lines missed.</span>
4246
- </div>
4247
- </div>
4248
-
4249
- <pre>
4250
- <ol>
4251
-
4252
- <li class="covered" data-hits="1" data-linenumber="1">
4253
- <span class="hits">1</span>
4254
-
4255
- <code class="ruby">class VariableArray &lt; Array</code>
4256
- </li>
4257
-
4258
- <li class="covered" data-hits="1" data-linenumber="2">
4259
- <span class="hits">1</span>
4260
-
4261
- <code class="ruby"> def ==(other)</code>
4262
- </li>
4263
-
4264
- <li class="covered" data-hits="7" data-linenumber="3">
4265
- <span class="hits">7</span>
4266
-
4267
- <code class="ruby"> if other.is_a?(Array)</code>
4268
- </li>
4269
-
4270
- <li class="covered" data-hits="7" data-linenumber="4">
4271
- <span class="hits">7</span>
4272
-
4273
- <code class="ruby"> comp = self[1..(self.length - 1)]</code>
4274
- </li>
4275
-
4276
- <li class="covered" data-hits="7" data-linenumber="5">
4277
- <span class="hits">7</span>
4278
-
4279
- <code class="ruby"> return comp.first == other.first</code>
4280
- </li>
4281
-
4282
- <li class="never" data-hits="" data-linenumber="6">
4283
-
4284
-
4285
- <code class="ruby"> else</code>
4286
- </li>
4287
-
4288
- <li class="missed" data-hits="0" data-linenumber="7">
4289
-
4290
-
4291
- <code class="ruby"> super</code>
4292
- </li>
4293
-
4294
- <li class="never" data-hits="" data-linenumber="8">
4295
-
4296
-
4297
- <code class="ruby"> end</code>
4298
- </li>
4299
-
4300
- <li class="never" data-hits="" data-linenumber="9">
4301
-
4302
-
4303
- <code class="ruby"> end</code>
4304
- </li>
4305
-
4306
- <li class="covered" data-hits="1" data-linenumber="10">
4307
- <span class="hits">1</span>
4308
-
4309
- <code class="ruby"> def collect(&amp;block)</code>
4310
- </li>
4311
-
4312
- <li class="covered" data-hits="5" data-linenumber="11">
4313
- <span class="hits">5</span>
4314
-
4315
- <code class="ruby"> self.class.new.tap do |ret|</code>
4316
- </li>
4317
-
4318
- <li class="covered" data-hits="5" data-linenumber="12">
4319
- <span class="hits">5</span>
4320
-
4321
- <code class="ruby"> self.each_with_index do |el, i|</code>
4322
- </li>
4323
-
4324
- <li class="covered" data-hits="10" data-linenumber="13">
4325
- <span class="hits">10</span>
4326
-
4327
- <code class="ruby"> ret[i] = block.call(el)</code>
4328
- </li>
4329
-
4330
- <li class="never" data-hits="" data-linenumber="14">
4331
-
4332
-
4333
- <code class="ruby"> end</code>
4334
- </li>
4335
-
4336
- <li class="never" data-hits="" data-linenumber="15">
4337
-
4338
-
4339
- <code class="ruby"> end</code>
4340
- </li>
4341
-
4342
- <li class="never" data-hits="" data-linenumber="16">
4343
-
4344
-
4345
- <code class="ruby"> end</code>
4346
- </li>
4347
-
4348
- <li class="covered" data-hits="1" data-linenumber="17">
4349
- <span class="hits">1</span>
4350
-
4351
- <code class="ruby"> alias_method :eql?, :==</code>
4352
- </li>
4353
-
4354
- <li class="never" data-hits="" data-linenumber="18">
4355
-
4356
-
4357
- <code class="ruby">end</code>
4358
- </li>
4359
-
4360
- </ol>
4361
- </pre>
4362
- </div>
4363
-
4364
- </div>
4365
- </div>
4366
- </body>
4367
- </html>