codin_rep 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codin_rep/get_records.rb +1 -1
- data/lib/codin_rep/mock_time_clock.rb +11 -5
- data/lib/codin_rep/version.rb +1 -1
- data/test/coverage/index.html +241 -187
- data/test/coverage/rcov/index.html +8 -8
- data/test/coverage/rcov/lib-codin_rep-add_employee_rb.html +1 -1
- data/test/coverage/rcov/lib-codin_rep-command_rb.html +1 -1
- data/test/coverage/rcov/lib-codin_rep-communication_rb.html +1 -1
- data/test/coverage/rcov/lib-codin_rep-del_employee_rb.html +1 -1
- data/test/coverage/rcov/lib-codin_rep-employee_command_rb.html +2 -2
- data/test/coverage/rcov/lib-codin_rep-get_afd_header_rb.html +1 -1
- data/test/coverage/rcov/lib-codin_rep-get_records_rb.html +2 -2
- data/test/coverage/rcov/lib-codin_rep-get_time_rb.html +2 -2
- data/test/coverage/rcov/lib-codin_rep-mock_time_clock_rb.html +147 -123
- data/test/coverage/rcov/lib-codin_rep-set_time_rb.html +1 -1
- data/test/coverage/rcov/lib-codin_rep-time_util_rb.html +1 -1
- data/test/coverage/rcov/lib-codin_rep-version_rb.html +2 -2
- data/test/coverage/rcov/lib-codin_rep_rb.html +50 -47
- metadata +2 -2
@@ -25,8 +25,8 @@
|
|
25
25
|
<tbody>
|
26
26
|
<tr>
|
27
27
|
<td class="left_align"><a href="lib-codin_rep-mock_time_clock_rb.html">lib/codin_rep/mock_time_clock.rb</a></td>
|
28
|
-
<td class='right_align'><tt>
|
29
|
-
<td class='right_align'><tt>
|
28
|
+
<td class='right_align'><tt>194</tt></td>
|
29
|
+
<td class='right_align'><tt>194</tt></td>
|
30
30
|
<td class="left_align"><div class="percent_graph_legend"><tt class=''>0.00%</tt></div>
|
31
31
|
<div class="percent_graph">
|
32
32
|
<div class="covered" style="width:0px"></div>
|
@@ -243,375 +243,399 @@
|
|
243
243
|
<td><pre><a name="line65">65</a> end</pre></td>
|
244
244
|
</tr>
|
245
245
|
<tr class="uncovered">
|
246
|
-
<td><pre><a name="line66">66</a>
|
246
|
+
<td><pre><a name="line66">66</a> rescue EOFError => e</pre></td>
|
247
247
|
</tr>
|
248
248
|
<tr class="uncovered">
|
249
|
-
<td><pre><a name="line67">67</a>
|
249
|
+
<td><pre><a name="line67">67</a> # Ignore EOF errors, as only the client should close connections.</pre></td>
|
250
250
|
</tr>
|
251
251
|
<tr class="uncovered">
|
252
|
-
<td><pre><a name="line68">68</a>
|
252
|
+
<td><pre><a name="line68">68</a> ensure</pre></td>
|
253
253
|
</tr>
|
254
254
|
<tr class="uncovered">
|
255
|
-
<td><pre><a name="line69">69</a>
|
255
|
+
<td><pre><a name="line69">69</a> socket.close unless socket.closed?</pre></td>
|
256
256
|
</tr>
|
257
257
|
<tr class="uncovered">
|
258
|
-
<td><pre><a name="line70">70</a>
|
258
|
+
<td><pre><a name="line70">70</a> @threadsMutex.synchronize {</pre></td>
|
259
259
|
</tr>
|
260
260
|
<tr class="uncovered">
|
261
|
-
<td><pre><a name="line71">71</a>
|
261
|
+
<td><pre><a name="line71">71</a> @threads.delete(Thread.current)</pre></td>
|
262
262
|
</tr>
|
263
263
|
<tr class="uncovered">
|
264
|
-
<td><pre><a name="line72">72</a>
|
264
|
+
<td><pre><a name="line72">72</a> }</pre></td>
|
265
265
|
</tr>
|
266
266
|
<tr class="uncovered">
|
267
|
-
<td><pre><a name="line73">73</a>
|
267
|
+
<td><pre><a name="line73">73</a> end</pre></td>
|
268
268
|
</tr>
|
269
269
|
<tr class="uncovered">
|
270
|
-
<td><pre><a name="line74">74</a>
|
270
|
+
<td><pre><a name="line74">74</a> end</pre></td>
|
271
271
|
</tr>
|
272
272
|
<tr class="uncovered">
|
273
|
-
<td><pre><a name="line75">75</a>
|
273
|
+
<td><pre><a name="line75">75</a> end</pre></td>
|
274
274
|
</tr>
|
275
275
|
<tr class="uncovered">
|
276
|
-
<td><pre><a name="line76">76</a>
|
276
|
+
<td><pre><a name="line76">76</a> </pre></td>
|
277
277
|
</tr>
|
278
278
|
<tr class="uncovered">
|
279
|
-
<td><pre><a name="line77">77</a>
|
279
|
+
<td><pre><a name="line77">77</a> def start</pre></td>
|
280
280
|
</tr>
|
281
281
|
<tr class="uncovered">
|
282
|
-
<td><pre><a name="line78">78</a>
|
282
|
+
<td><pre><a name="line78">78</a> @server_thread = Thread.new do</pre></td>
|
283
283
|
</tr>
|
284
284
|
<tr class="uncovered">
|
285
|
-
<td><pre><a name="line79">79</a>
|
285
|
+
<td><pre><a name="line79">79</a> Thread.current.abort_on_exception = true</pre></td>
|
286
286
|
</tr>
|
287
287
|
<tr class="uncovered">
|
288
|
-
<td><pre><a name="line80">80</a>
|
288
|
+
<td><pre><a name="line80">80</a> @running = true</pre></td>
|
289
289
|
</tr>
|
290
290
|
<tr class="uncovered">
|
291
|
-
<td><pre><a name="line81">81</a>
|
291
|
+
<td><pre><a name="line81">81</a> while @running</pre></td>
|
292
292
|
</tr>
|
293
293
|
<tr class="uncovered">
|
294
|
-
<td><pre><a name="line82">82</a>
|
294
|
+
<td><pre><a name="line82">82</a> break if @server.closed?</pre></td>
|
295
295
|
</tr>
|
296
296
|
<tr class="uncovered">
|
297
|
-
<td><pre><a name="line83">83</a>
|
297
|
+
<td><pre><a name="line83">83</a> socket = @server.accept</pre></td>
|
298
298
|
</tr>
|
299
299
|
<tr class="uncovered">
|
300
|
-
<td><pre><a name="line84">84</a>
|
300
|
+
<td><pre><a name="line84">84</a> serve(socket)</pre></td>
|
301
301
|
</tr>
|
302
302
|
<tr class="uncovered">
|
303
|
-
<td><pre><a name="line85">85</a>
|
303
|
+
<td><pre><a name="line85">85</a> end</pre></td>
|
304
304
|
</tr>
|
305
305
|
<tr class="uncovered">
|
306
|
-
<td><pre><a name="line86">86</a>
|
306
|
+
<td><pre><a name="line86">86</a> end</pre></td>
|
307
307
|
</tr>
|
308
308
|
<tr class="uncovered">
|
309
|
-
<td><pre><a name="line87">87</a>
|
309
|
+
<td><pre><a name="line87">87</a> self</pre></td>
|
310
310
|
</tr>
|
311
311
|
<tr class="uncovered">
|
312
|
-
<td><pre><a name="line88">88</a>
|
312
|
+
<td><pre><a name="line88">88</a> end</pre></td>
|
313
313
|
</tr>
|
314
314
|
<tr class="uncovered">
|
315
|
-
<td><pre><a name="line89">89</a>
|
315
|
+
<td><pre><a name="line89">89</a> </pre></td>
|
316
316
|
</tr>
|
317
317
|
<tr class="uncovered">
|
318
|
-
<td><pre><a name="line90">90</a>
|
318
|
+
<td><pre><a name="line90">90</a> def stop</pre></td>
|
319
319
|
</tr>
|
320
320
|
<tr class="uncovered">
|
321
|
-
<td><pre><a name="line91">91</a>
|
321
|
+
<td><pre><a name="line91">91</a> @threadsMutex.synchronize {</pre></td>
|
322
322
|
</tr>
|
323
323
|
<tr class="uncovered">
|
324
|
-
<td><pre><a name="line92">92</a>
|
324
|
+
<td><pre><a name="line92">92</a> @threads.each{|thread| thread.kill}</pre></td>
|
325
325
|
</tr>
|
326
326
|
<tr class="uncovered">
|
327
|
-
<td><pre><a name="line93">93</a>
|
327
|
+
<td><pre><a name="line93">93</a> @threads = []</pre></td>
|
328
328
|
</tr>
|
329
329
|
<tr class="uncovered">
|
330
|
-
<td><pre><a name="line94">94</a>
|
330
|
+
<td><pre><a name="line94">94</a> }</pre></td>
|
331
331
|
</tr>
|
332
332
|
<tr class="uncovered">
|
333
|
-
<td><pre><a name="line95">95</a> @server_thread.
|
333
|
+
<td><pre><a name="line95">95</a> @server_thread.kill if @server_thread</pre></td>
|
334
334
|
</tr>
|
335
335
|
<tr class="uncovered">
|
336
|
-
<td><pre><a name="line96">96</a> @
|
336
|
+
<td><pre><a name="line96">96</a> @server.close unless @server.closed?</pre></td>
|
337
337
|
</tr>
|
338
338
|
<tr class="uncovered">
|
339
|
-
<td><pre><a name="line97">97</a>
|
339
|
+
<td><pre><a name="line97">97</a> @server_thread.join</pre></td>
|
340
340
|
</tr>
|
341
341
|
<tr class="uncovered">
|
342
|
-
<td><pre><a name="line98">98</a>
|
342
|
+
<td><pre><a name="line98">98</a> @running = false</pre></td>
|
343
343
|
</tr>
|
344
344
|
<tr class="uncovered">
|
345
|
-
<td><pre><a name="line99">99</a>
|
345
|
+
<td><pre><a name="line99">99</a> true</pre></td>
|
346
346
|
</tr>
|
347
347
|
<tr class="uncovered">
|
348
|
-
<td><pre><a name="line100">100</a>
|
348
|
+
<td><pre><a name="line100">100</a> end</pre></td>
|
349
349
|
</tr>
|
350
350
|
<tr class="uncovered">
|
351
|
-
<td><pre><a name="line101">101</a>
|
351
|
+
<td><pre><a name="line101">101</a> </pre></td>
|
352
352
|
</tr>
|
353
353
|
<tr class="uncovered">
|
354
|
-
<td><pre><a name="line102">102</a>
|
354
|
+
<td><pre><a name="line102">102</a> def running?</pre></td>
|
355
355
|
</tr>
|
356
356
|
<tr class="uncovered">
|
357
|
-
<td><pre><a name="line103">103</a>
|
357
|
+
<td><pre><a name="line103">103</a> @running</pre></td>
|
358
358
|
</tr>
|
359
359
|
<tr class="uncovered">
|
360
|
-
<td><pre><a name="line104">104</a>
|
360
|
+
<td><pre><a name="line104">104</a> end</pre></td>
|
361
361
|
</tr>
|
362
362
|
<tr class="uncovered">
|
363
|
-
<td><pre><a name="line105">105</a>
|
363
|
+
<td><pre><a name="line105">105</a> </pre></td>
|
364
364
|
</tr>
|
365
365
|
<tr class="uncovered">
|
366
|
-
<td><pre><a name="line106">106</a>
|
366
|
+
<td><pre><a name="line106">106</a> private</pre></td>
|
367
367
|
</tr>
|
368
368
|
<tr class="uncovered">
|
369
|
-
<td><pre><a name="line107">107</a>
|
369
|
+
<td><pre><a name="line107">107</a> def process_command(raw_command, socket)</pre></td>
|
370
370
|
</tr>
|
371
371
|
<tr class="uncovered">
|
372
|
-
<td><pre><a name="line108">108</a>
|
372
|
+
<td><pre><a name="line108">108</a> case raw_command</pre></td>
|
373
373
|
</tr>
|
374
374
|
<tr class="uncovered">
|
375
|
-
<td><pre><a name="line109">109</a> when "
|
375
|
+
<td><pre><a name="line109">109</a> when "PGREP009b" # Get time</pre></td>
|
376
376
|
</tr>
|
377
377
|
<tr class="uncovered">
|
378
|
-
<td><pre><a name="line110">110</a>
|
378
|
+
<td><pre><a name="line110">110</a> response = 'REP008b' + get_timeclock_time</pre></td>
|
379
379
|
</tr>
|
380
380
|
<tr class="uncovered">
|
381
|
-
<td><pre><a name="line111">111</a>
|
381
|
+
<td><pre><a name="line111">111</a> when "PGREP016A" # Set time</pre></td>
|
382
382
|
</tr>
|
383
383
|
<tr class="uncovered">
|
384
|
-
<td><pre><a name="line112">112</a>
|
384
|
+
<td><pre><a name="line112">112</a> payload = read_from_socket_with_timeout(socket, 7)</pre></td>
|
385
385
|
</tr>
|
386
386
|
<tr class="uncovered">
|
387
|
-
<td><pre><a name="line113">113</a>
|
387
|
+
<td><pre><a name="line113">113</a> response = 'REP008A' + payload</pre></td>
|
388
388
|
</tr>
|
389
389
|
<tr class="uncovered">
|
390
|
-
<td><pre><a name="line114">114</a>
|
390
|
+
<td><pre><a name="line114">114</a> set_timeclock_time(payload)</pre></td>
|
391
391
|
</tr>
|
392
392
|
<tr class="uncovered">
|
393
|
-
<td><pre><a name="line115">115</a>
|
393
|
+
<td><pre><a name="line115">115</a> when "PGREP009Z"</pre></td>
|
394
394
|
</tr>
|
395
395
|
<tr class="uncovered">
|
396
|
-
<td><pre><a name="line116">116</a>
|
396
|
+
<td><pre><a name="line116">116</a> response = 'REP2359' + @data.afd.header.export + "\r\n"</pre></td>
|
397
397
|
</tr>
|
398
398
|
<tr class="uncovered">
|
399
|
-
<td><pre><a name="line117">117</a> @
|
399
|
+
<td><pre><a name="line117">117</a> @keep_connected = false</pre></td>
|
400
400
|
</tr>
|
401
401
|
<tr class="uncovered">
|
402
|
-
<td><pre><a name="line118">118</a>
|
402
|
+
<td><pre><a name="line118">118</a> when "PGREP0289"</pre></td>
|
403
403
|
</tr>
|
404
404
|
<tr class="uncovered">
|
405
|
-
<td><pre><a name="line119">119</a>
|
405
|
+
<td><pre><a name="line119">119</a> byte = read_from_socket_with_timeout(socket, 1)</pre></td>
|
406
406
|
</tr>
|
407
407
|
<tr class="uncovered">
|
408
|
-
<td><pre><a name="line120">120</a>
|
408
|
+
<td><pre><a name="line120">120</a> if byte == "0"</pre></td>
|
409
409
|
</tr>
|
410
410
|
<tr class="uncovered">
|
411
|
-
<td><pre><a name="line121">121</a>
|
411
|
+
<td><pre><a name="line121">121</a> @afd_read_start_id = read_from_socket_with_timeout(socket, 9).to_i</pre></td>
|
412
412
|
</tr>
|
413
413
|
<tr class="uncovered">
|
414
|
-
<td><pre><a name="line122">122</a>
|
414
|
+
<td><pre><a name="line122">122</a> @afd_read_end_id = read_from_socket_with_timeout(socket, 9).to_i</pre></td>
|
415
415
|
</tr>
|
416
416
|
<tr class="uncovered">
|
417
|
-
<td><pre><a name="line123">123</a>
|
417
|
+
<td><pre><a name="line123">123</a> @afd_read_current_id = nil</pre></td>
|
418
418
|
</tr>
|
419
419
|
<tr class="uncovered">
|
420
|
-
<td><pre><a name="line124">124</a>
|
420
|
+
<td><pre><a name="line124">124</a> @afd_read_finished = false</pre></td>
|
421
421
|
</tr>
|
422
422
|
<tr class="uncovered">
|
423
|
-
<td><pre><a name="line125">125</a>
|
423
|
+
<td><pre><a name="line125">125</a> response = "REP0029["</pre></td>
|
424
424
|
</tr>
|
425
425
|
<tr class="uncovered">
|
426
426
|
<td><pre><a name="line126">126</a> else</pre></td>
|
427
427
|
</tr>
|
428
428
|
<tr class="uncovered">
|
429
|
-
<td><pre><a name="line127">127</a>
|
429
|
+
<td><pre><a name="line127">127</a> raw_command += byte</pre></td>
|
430
430
|
</tr>
|
431
431
|
<tr class="uncovered">
|
432
|
-
<td><pre><a name="line128">128</a>
|
432
|
+
<td><pre><a name="line128">128</a> raise StandardError.new("Unknown command \"#{raw_command}\"!")</pre></td>
|
433
433
|
</tr>
|
434
434
|
<tr class="uncovered">
|
435
|
-
<td><pre><a name="line129">129</a>
|
435
|
+
<td><pre><a name="line129">129</a> end</pre></td>
|
436
436
|
</tr>
|
437
437
|
<tr class="uncovered">
|
438
|
-
<td><pre><a name="line130">130</a>
|
438
|
+
<td><pre><a name="line130">130</a> when "PGREP009,"</pre></td>
|
439
439
|
</tr>
|
440
440
|
<tr class="uncovered">
|
441
|
-
<td><pre><a name="line131">131</a>
|
441
|
+
<td><pre><a name="line131">131</a> if @afd_read_finished</pre></td>
|
442
442
|
</tr>
|
443
443
|
<tr class="uncovered">
|
444
|
-
<td><pre><a name="line132">132</a>
|
444
|
+
<td><pre><a name="line132">132</a> response = "REP0029]"</pre></td>
|
445
445
|
</tr>
|
446
446
|
<tr class="uncovered">
|
447
|
-
<td><pre><a name="line133">133</a>
|
447
|
+
<td><pre><a name="line133">133</a> @keep_connected = false</pre></td>
|
448
448
|
</tr>
|
449
449
|
<tr class="uncovered">
|
450
|
-
<td><pre><a name="line134">134</a>
|
450
|
+
<td><pre><a name="line134">134</a> else</pre></td>
|
451
451
|
</tr>
|
452
452
|
<tr class="uncovered">
|
453
|
-
<td><pre><a name="line135">135</a>
|
453
|
+
<td><pre><a name="line135">135</a> if @afd_read_current_id.nil?</pre></td>
|
454
454
|
</tr>
|
455
455
|
<tr class="uncovered">
|
456
|
-
<td><pre><a name="line136">136</a>
|
456
|
+
<td><pre><a name="line136">136</a> @afd_read_current_id = @afd_read_start_id</pre></td>
|
457
457
|
</tr>
|
458
458
|
<tr class="uncovered">
|
459
|
-
<td><pre><a name="line137">137</a>
|
459
|
+
<td><pre><a name="line137">137</a> response = 'REP3029'</pre></td>
|
460
460
|
</tr>
|
461
461
|
<tr class="uncovered">
|
462
|
-
<td><pre><a name="line138">138</a>
|
462
|
+
<td><pre><a name="line138">138</a> elsif @afd_read_current_id == @afd_read_end_id or @afd_read_current_id >= @data.afd.records.size</pre></td>
|
463
463
|
</tr>
|
464
464
|
<tr class="uncovered">
|
465
|
-
<td><pre><a name="line139">139</a>
|
465
|
+
<td><pre><a name="line139">139</a> response = 'REP0909'</pre></td>
|
466
466
|
</tr>
|
467
467
|
<tr class="uncovered">
|
468
|
-
<td><pre><a name="line140">140</a>
|
468
|
+
<td><pre><a name="line140">140</a> @afd_read_finished = true</pre></td>
|
469
469
|
</tr>
|
470
470
|
<tr class="uncovered">
|
471
|
-
<td><pre><a name="line141">141</a>
|
471
|
+
<td><pre><a name="line141">141</a> else</pre></td>
|
472
472
|
</tr>
|
473
473
|
<tr class="uncovered">
|
474
|
-
<td><pre><a name="line142">142</a>
|
474
|
+
<td><pre><a name="line142">142</a> response = 'REP0379'</pre></td>
|
475
475
|
</tr>
|
476
476
|
<tr class="uncovered">
|
477
|
-
<td><pre><a name="line143">143</a>
|
477
|
+
<td><pre><a name="line143">143</a> end</pre></td>
|
478
478
|
</tr>
|
479
479
|
<tr class="uncovered">
|
480
|
-
<td><pre><a name="line144">144</a>
|
480
|
+
<td><pre><a name="line144">144</a> afd_records = ([@data.afd.header] + @data.afd.records)</pre></td>
|
481
481
|
</tr>
|
482
482
|
<tr class="uncovered">
|
483
|
-
<td><pre><a name="line145">145</a>
|
483
|
+
<td><pre><a name="line145">145</a> response += afd_records[@afd_read_current_id].export + "\r\n"</pre></td>
|
484
484
|
</tr>
|
485
485
|
<tr class="uncovered">
|
486
|
-
<td><pre><a name="line146">146</a>
|
486
|
+
<td><pre><a name="line146">146</a> end</pre></td>
|
487
487
|
</tr>
|
488
488
|
<tr class="uncovered">
|
489
|
-
<td><pre><a name="line147">147</a>
|
489
|
+
<td><pre><a name="line147">147</a> @afd_read_current_id += 1</pre></td>
|
490
490
|
</tr>
|
491
491
|
<tr class="uncovered">
|
492
|
-
<td><pre><a name="line148">148</a> when "
|
492
|
+
<td><pre><a name="line148">148</a> when "PGREP075h"</pre></td>
|
493
493
|
</tr>
|
494
494
|
<tr class="uncovered">
|
495
|
-
<td><pre><a name="line149">149</a> payload = read_from_socket_with_timeout(socket,
|
495
|
+
<td><pre><a name="line149">149</a> payload = read_from_socket_with_timeout(socket, 66)</pre></td>
|
496
496
|
</tr>
|
497
497
|
<tr class="uncovered">
|
498
|
-
<td><pre><a name="line150">150</a> raw_registration = payload.scan(/.(.{6})/).flatten
|
498
|
+
<td><pre><a name="line150">150</a> raw_registration, raw_pis, raw_name = payload.scan(/.(.{6})(.{6})(.+)/).flatten</pre></td>
|
499
499
|
</tr>
|
500
500
|
<tr class="uncovered">
|
501
501
|
<td><pre><a name="line151">151</a> registration = convert_bytes_to_string(raw_registration)</pre></td>
|
502
502
|
</tr>
|
503
503
|
<tr class="uncovered">
|
504
|
-
<td><pre><a name="line152">152</a>
|
504
|
+
<td><pre><a name="line152">152</a> pis = convert_bytes_to_string(raw_pis)</pre></td>
|
505
505
|
</tr>
|
506
506
|
<tr class="uncovered">
|
507
|
-
<td><pre><a name="line153">153</a>
|
507
|
+
<td><pre><a name="line153">153</a> name = raw_name.strip</pre></td>
|
508
508
|
</tr>
|
509
509
|
<tr class="uncovered">
|
510
|
-
<td><pre><a name="line154">154</a>
|
510
|
+
<td><pre><a name="line154">154</a> @data.employees << {name: name, pis: pis, registration: registration}</pre></td>
|
511
511
|
</tr>
|
512
512
|
<tr class="uncovered">
|
513
|
-
<td><pre><a name="line155">155</a>
|
513
|
+
<td><pre><a name="line155">155</a> response = "REP003h1\0"</pre></td>
|
514
514
|
</tr>
|
515
515
|
<tr class="uncovered">
|
516
|
-
<td><pre><a name="line156">156</a>
|
516
|
+
<td><pre><a name="line156">156</a> when "PGREP016j"</pre></td>
|
517
517
|
</tr>
|
518
518
|
<tr class="uncovered">
|
519
|
-
<td><pre><a name="line157">157</a>
|
519
|
+
<td><pre><a name="line157">157</a> payload = read_from_socket_with_timeout(socket, 7)</pre></td>
|
520
520
|
</tr>
|
521
521
|
<tr class="uncovered">
|
522
|
-
<td><pre><a name="line158">158</a>
|
522
|
+
<td><pre><a name="line158">158</a> raw_registration = payload.scan(/.(.{6})/).flatten[0]</pre></td>
|
523
523
|
</tr>
|
524
524
|
<tr class="uncovered">
|
525
|
-
<td><pre><a name="line159">159</a>
|
525
|
+
<td><pre><a name="line159">159</a> registration = convert_bytes_to_string(raw_registration)</pre></td>
|
526
526
|
</tr>
|
527
527
|
<tr class="uncovered">
|
528
|
-
<td><pre><a name="line160">160</a>
|
528
|
+
<td><pre><a name="line160">160</a> @data.employees.delete_if{|employee| employee[:registration] == registration}</pre></td>
|
529
529
|
</tr>
|
530
530
|
<tr class="uncovered">
|
531
|
-
<td><pre><a name="line161">161</a>
|
531
|
+
<td><pre><a name="line161">161</a> response = "REP003j1\0"</pre></td>
|
532
532
|
</tr>
|
533
533
|
<tr class="uncovered">
|
534
|
-
<td><pre><a name="line162">162</a>
|
534
|
+
<td><pre><a name="line162">162</a> when 'PGREP010h', 'PGREP010j'</pre></td>
|
535
535
|
</tr>
|
536
536
|
<tr class="uncovered">
|
537
|
-
<td><pre><a name="line163">163</a>
|
537
|
+
<td><pre><a name="line163">163</a> # Don't care for the result of these comands, just disconnect when</pre></td>
|
538
538
|
</tr>
|
539
539
|
<tr class="uncovered">
|
540
|
-
<td><pre><a name="line164">164</a>
|
540
|
+
<td><pre><a name="line164">164</a> # possible.</pre></td>
|
541
541
|
</tr>
|
542
542
|
<tr class="uncovered">
|
543
|
-
<td><pre><a name="line165">165</a>
|
543
|
+
<td><pre><a name="line165">165</a> @keep_connected = false</pre></td>
|
544
544
|
</tr>
|
545
545
|
<tr class="uncovered">
|
546
|
-
<td><pre><a name="line166">166</a>
|
546
|
+
<td><pre><a name="line166">166</a> response = ""</pre></td>
|
547
547
|
</tr>
|
548
548
|
<tr class="uncovered">
|
549
|
-
<td><pre><a name="line167">167</a>
|
549
|
+
<td><pre><a name="line167">167</a> else</pre></td>
|
550
550
|
</tr>
|
551
551
|
<tr class="uncovered">
|
552
|
-
<td><pre><a name="line168">168</a>
|
552
|
+
<td><pre><a name="line168">168</a> raise StandardError.new("Unknown command \"#{raw_command}\"!")</pre></td>
|
553
553
|
</tr>
|
554
554
|
<tr class="uncovered">
|
555
|
-
<td><pre><a name="line169">169</a>
|
555
|
+
<td><pre><a name="line169">169</a> end</pre></td>
|
556
556
|
</tr>
|
557
557
|
<tr class="uncovered">
|
558
|
-
<td><pre><a name="line170">170</a>
|
558
|
+
<td><pre><a name="line170">170</a> response</pre></td>
|
559
559
|
</tr>
|
560
560
|
<tr class="uncovered">
|
561
|
-
<td><pre><a name="line171">171</a>
|
561
|
+
<td><pre><a name="line171">171</a> end</pre></td>
|
562
562
|
</tr>
|
563
563
|
<tr class="uncovered">
|
564
|
-
<td><pre><a name="line172">172</a>
|
564
|
+
<td><pre><a name="line172">172</a> </pre></td>
|
565
565
|
</tr>
|
566
566
|
<tr class="uncovered">
|
567
|
-
<td><pre><a name="line173">173</a>
|
567
|
+
<td><pre><a name="line173">173</a> def read_from_socket_with_timeout(socket, bytes_to_be_read, timeout_value=5)</pre></td>
|
568
568
|
</tr>
|
569
569
|
<tr class="uncovered">
|
570
|
-
<td><pre><a name="line174">174</a>
|
570
|
+
<td><pre><a name="line174">174</a> data_to_receive = nil</pre></td>
|
571
571
|
</tr>
|
572
572
|
<tr class="uncovered">
|
573
|
-
<td><pre><a name="line175">175</a>
|
573
|
+
<td><pre><a name="line175">175</a> timeout_value = 600 if @first_connection # use a large timeout on first connection</pre></td>
|
574
574
|
</tr>
|
575
575
|
<tr class="uncovered">
|
576
|
-
<td><pre><a name="line176">176</a> </pre></td>
|
576
|
+
<td><pre><a name="line176">176</a> timeout(timeout_value) { data_to_receive = socket.readpartial( bytes_to_be_read ) }</pre></td>
|
577
577
|
</tr>
|
578
578
|
<tr class="uncovered">
|
579
|
-
<td><pre><a name="line177">177</a>
|
579
|
+
<td><pre><a name="line177">177</a> return data_to_receive</pre></td>
|
580
580
|
</tr>
|
581
581
|
<tr class="uncovered">
|
582
|
-
<td><pre><a name="line178">178</a>
|
582
|
+
<td><pre><a name="line178">178</a> end</pre></td>
|
583
583
|
</tr>
|
584
584
|
<tr class="uncovered">
|
585
|
-
<td><pre><a name="line179">179</a>
|
585
|
+
<td><pre><a name="line179">179</a> </pre></td>
|
586
586
|
</tr>
|
587
587
|
<tr class="uncovered">
|
588
|
-
<td><pre><a name="line180">180</a>
|
588
|
+
<td><pre><a name="line180">180</a> def get_timeclock_time(current_time=nil)</pre></td>
|
589
589
|
</tr>
|
590
590
|
<tr class="uncovered">
|
591
|
-
<td><pre><a name="line181">181</a>
|
591
|
+
<td><pre><a name="line181">181</a> current_time ||= @data.time</pre></td>
|
592
592
|
</tr>
|
593
593
|
<tr class="uncovered">
|
594
|
-
<td><pre><a name="line182">182</a> </pre></td>
|
594
|
+
<td><pre><a name="line182">182</a> CodinRep::TimeUtil.pack current_time</pre></td>
|
595
595
|
</tr>
|
596
596
|
<tr class="uncovered">
|
597
|
-
<td><pre><a name="line183">183</a>
|
597
|
+
<td><pre><a name="line183">183</a> end</pre></td>
|
598
598
|
</tr>
|
599
599
|
<tr class="uncovered">
|
600
|
-
<td><pre><a name="line184">184</a>
|
600
|
+
<td><pre><a name="line184">184</a> </pre></td>
|
601
601
|
</tr>
|
602
602
|
<tr class="uncovered">
|
603
|
-
<td><pre><a name="line185">185</a>
|
603
|
+
<td><pre><a name="line185">185</a> def set_timeclock_time(payload)</pre></td>
|
604
604
|
</tr>
|
605
605
|
<tr class="uncovered">
|
606
|
-
<td><pre><a name="line186">186</a>
|
606
|
+
<td><pre><a name="line186">186</a> time = CodinRep::TimeUtil.unpack payload</pre></td>
|
607
607
|
</tr>
|
608
608
|
<tr class="uncovered">
|
609
|
-
<td><pre><a name="line187">187</a>
|
609
|
+
<td><pre><a name="line187">187</a> @data.time = time</pre></td>
|
610
|
+
</tr>
|
611
|
+
<tr class="uncovered">
|
612
|
+
<td><pre><a name="line188">188</a> return time</pre></td>
|
613
|
+
</tr>
|
614
|
+
<tr class="uncovered">
|
615
|
+
<td><pre><a name="line189">189</a> end</pre></td>
|
616
|
+
</tr>
|
617
|
+
<tr class="uncovered">
|
618
|
+
<td><pre><a name="line190">190</a> </pre></td>
|
619
|
+
</tr>
|
620
|
+
<tr class="uncovered">
|
621
|
+
<td><pre><a name="line191">191</a> def convert_bytes_to_string(bytes)</pre></td>
|
622
|
+
</tr>
|
623
|
+
<tr class="uncovered">
|
624
|
+
<td><pre><a name="line192">192</a> bytes.unpack('H*')[0]</pre></td>
|
625
|
+
</tr>
|
626
|
+
<tr class="uncovered">
|
627
|
+
<td><pre><a name="line193">193</a> end</pre></td>
|
628
|
+
</tr>
|
629
|
+
<tr class="uncovered">
|
630
|
+
<td><pre><a name="line194">194</a> end</pre></td>
|
631
|
+
</tr>
|
632
|
+
<tr class="uncovered">
|
633
|
+
<td><pre><a name="line195">195</a> end</pre></td>
|
610
634
|
</tr>
|
611
635
|
</tbody>
|
612
636
|
</table>
|
613
637
|
|
614
|
-
<p>Generated on 2017-
|
638
|
+
<p>Generated on 2017-02-21 09:19:39 -0300 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
|
615
639
|
|
616
640
|
</body>
|
617
641
|
</html>
|
@@ -236,7 +236,7 @@
|
|
236
236
|
</tbody>
|
237
237
|
</table>
|
238
238
|
|
239
|
-
<p>Generated on 2017-
|
239
|
+
<p>Generated on 2017-02-21 09:19:39 -0300 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
|
240
240
|
|
241
241
|
</body>
|
242
242
|
</html>
|
@@ -206,7 +206,7 @@
|
|
206
206
|
</tbody>
|
207
207
|
</table>
|
208
208
|
|
209
|
-
<p>Generated on 2017-
|
209
|
+
<p>Generated on 2017-02-21 09:19:39 -0300 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
|
210
210
|
|
211
211
|
</body>
|
212
212
|
</html>
|
@@ -114,7 +114,7 @@
|
|
114
114
|
<td><pre><a name="line22">22</a> module CodinRep</pre></td>
|
115
115
|
</tr>
|
116
116
|
<tr class="marked">
|
117
|
-
<td><pre><a name="line23">23</a> VERSION = "0.2.
|
117
|
+
<td><pre><a name="line23">23</a> VERSION = "0.2.5".freeze</pre></td>
|
118
118
|
</tr>
|
119
119
|
<tr class="inferred">
|
120
120
|
<td><pre><a name="line24">24</a> end</pre></td>
|
@@ -122,7 +122,7 @@
|
|
122
122
|
</tbody>
|
123
123
|
</table>
|
124
124
|
|
125
|
-
<p>Generated on 2017-
|
125
|
+
<p>Generated on 2017-02-21 09:19:39 -0300 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
|
126
126
|
|
127
127
|
</body>
|
128
128
|
</html>
|