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
data/test/coverage/index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
<img src="./assets/0.10.0/loading.gif" alt="loading"/>
|
15
15
|
</div>
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
|
-
<div class="timestamp">Generated <abbr class="timeago" title="2017-
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2017-02-21T09:19:39-03:00">2017-02-21T09:19:39-03:00</abbr></div>
|
18
18
|
<ul class="group_tabs"></ul>
|
19
19
|
|
20
20
|
<div id="content">
|
@@ -32,9 +32,9 @@
|
|
32
32
|
<a name="AllFiles"></a>
|
33
33
|
<div>
|
34
34
|
<b>13</b> files in total.
|
35
|
-
<b>
|
35
|
+
<b>1080</b> relevant lines.
|
36
36
|
<span class="green"><b>2</b> lines covered</span> and
|
37
|
-
<span class="red"><b>
|
37
|
+
<span class="red"><b>1078</b> lines missed </span>
|
38
38
|
</div>
|
39
39
|
<table class="file_list">
|
40
40
|
<thead>
|
@@ -53,10 +53,10 @@
|
|
53
53
|
<tr>
|
54
54
|
<td class="strong"><a href="#528b0843dec5d3ab68fcc205304e1ade6d6de0fa" class="src_link" title="lib/codin_rep.rb">lib/codin_rep.rb</a></td>
|
55
55
|
<td class="red strong">0.0 %</td>
|
56
|
-
<td>
|
57
|
-
<td>
|
56
|
+
<td>87</td>
|
57
|
+
<td>87</td>
|
58
58
|
<td>0</td>
|
59
|
-
<td>
|
59
|
+
<td>87</td>
|
60
60
|
<td>0.0</td>
|
61
61
|
</tr>
|
62
62
|
|
@@ -143,10 +143,10 @@
|
|
143
143
|
<tr>
|
144
144
|
<td class="strong"><a href="#eafa662feda24b9dc266cb168febb2abf1d20de2" class="src_link" title="lib/codin_rep/mock_time_clock.rb">lib/codin_rep/mock_time_clock.rb</a></td>
|
145
145
|
<td class="red strong">0.0 %</td>
|
146
|
-
<td>
|
147
|
-
<td>
|
146
|
+
<td>194</td>
|
147
|
+
<td>194</td>
|
148
148
|
<td>0</td>
|
149
|
-
<td>
|
149
|
+
<td>194</td>
|
150
150
|
<td>0.0</td>
|
151
151
|
</tr>
|
152
152
|
|
@@ -385,9 +385,9 @@
|
|
385
385
|
<a name="Libraries"></a>
|
386
386
|
<div>
|
387
387
|
<b>13</b> files in total.
|
388
|
-
<b>
|
388
|
+
<b>1080</b> relevant lines.
|
389
389
|
<span class="green"><b>2</b> lines covered</span> and
|
390
|
-
<span class="red"><b>
|
390
|
+
<span class="red"><b>1078</b> lines missed </span>
|
391
391
|
</div>
|
392
392
|
<table class="file_list">
|
393
393
|
<thead>
|
@@ -406,10 +406,10 @@
|
|
406
406
|
<tr>
|
407
407
|
<td class="strong"><a href="#528b0843dec5d3ab68fcc205304e1ade6d6de0fa" class="src_link" title="lib/codin_rep.rb">lib/codin_rep.rb</a></td>
|
408
408
|
<td class="red strong">0.0 %</td>
|
409
|
-
<td>
|
410
|
-
<td>
|
409
|
+
<td>87</td>
|
410
|
+
<td>87</td>
|
411
411
|
<td>0</td>
|
412
|
-
<td>
|
412
|
+
<td>87</td>
|
413
413
|
<td>0.0</td>
|
414
414
|
</tr>
|
415
415
|
|
@@ -496,10 +496,10 @@
|
|
496
496
|
<tr>
|
497
497
|
<td class="strong"><a href="#eafa662feda24b9dc266cb168febb2abf1d20de2" class="src_link" title="lib/codin_rep/mock_time_clock.rb">lib/codin_rep/mock_time_clock.rb</a></td>
|
498
498
|
<td class="red strong">0.0 %</td>
|
499
|
-
<td>
|
500
|
-
<td>
|
499
|
+
<td>194</td>
|
500
|
+
<td>194</td>
|
501
501
|
<td>0</td>
|
502
|
-
<td>
|
502
|
+
<td>194</td>
|
503
503
|
<td>0.0</td>
|
504
504
|
</tr>
|
505
505
|
|
@@ -553,9 +553,9 @@
|
|
553
553
|
<h3>lib/codin_rep.rb</h3>
|
554
554
|
<h4><span class="red">0.0 %</span> covered</h4>
|
555
555
|
<div>
|
556
|
-
<b>
|
556
|
+
<b>87</b> relevant lines.
|
557
557
|
<span class="green"><b>0</b> lines covered</span> and
|
558
|
-
<span class="red"><b>
|
558
|
+
<span class="red"><b>87</b> lines missed.</span>
|
559
559
|
</div>
|
560
560
|
</div>
|
561
561
|
|
@@ -817,264 +817,270 @@
|
|
817
817
|
<li class="missed" data-hits="0" data-linenumber="43">
|
818
818
|
|
819
819
|
|
820
|
-
<code class="ruby">
|
820
|
+
<code class="ruby"> # the DST parameters are just placeholders, for now.</code>
|
821
821
|
</li>
|
822
822
|
|
823
823
|
<li class="missed" data-hits="0" data-linenumber="44">
|
824
824
|
|
825
825
|
|
826
|
-
<code class="ruby">
|
826
|
+
<code class="ruby"> def set_time(time, dst_start=nil, dst_end=nil)</code>
|
827
827
|
</li>
|
828
828
|
|
829
829
|
<li class="missed" data-hits="0" data-linenumber="45">
|
830
830
|
|
831
831
|
|
832
|
-
<code class="ruby">
|
832
|
+
<code class="ruby"> command = CodinRep::SetTime.new(time, self.ip, self.tcp_port)</code>
|
833
833
|
</li>
|
834
834
|
|
835
835
|
<li class="missed" data-hits="0" data-linenumber="46">
|
836
836
|
|
837
837
|
|
838
|
-
<code class="ruby">
|
838
|
+
<code class="ruby"> response = command.execute</code>
|
839
839
|
</li>
|
840
840
|
|
841
841
|
<li class="missed" data-hits="0" data-linenumber="47">
|
842
842
|
|
843
843
|
|
844
|
-
<code class="ruby">
|
844
|
+
<code class="ruby"> return response</code>
|
845
845
|
</li>
|
846
846
|
|
847
847
|
<li class="missed" data-hits="0" data-linenumber="48">
|
848
848
|
|
849
849
|
|
850
|
-
<code class="ruby"
|
850
|
+
<code class="ruby"> end</code>
|
851
851
|
</li>
|
852
852
|
|
853
853
|
<li class="missed" data-hits="0" data-linenumber="49">
|
854
854
|
|
855
855
|
|
856
|
-
<code class="ruby"
|
856
|
+
<code class="ruby"></code>
|
857
857
|
</li>
|
858
858
|
|
859
859
|
<li class="missed" data-hits="0" data-linenumber="50">
|
860
860
|
|
861
861
|
|
862
|
-
<code class="ruby">
|
862
|
+
<code class="ruby"> def get_employer</code>
|
863
863
|
</li>
|
864
864
|
|
865
865
|
<li class="missed" data-hits="0" data-linenumber="51">
|
866
866
|
|
867
867
|
|
868
|
-
<code class="ruby">
|
868
|
+
<code class="ruby"> command = CodinRep::GetAfdHeader.new(self.ip, self.tcp_port)</code>
|
869
869
|
</li>
|
870
870
|
|
871
871
|
<li class="missed" data-hits="0" data-linenumber="52">
|
872
872
|
|
873
873
|
|
874
|
-
<code class="ruby"
|
874
|
+
<code class="ruby"> response = command.execute</code>
|
875
875
|
</li>
|
876
876
|
|
877
877
|
<li class="missed" data-hits="0" data-linenumber="53">
|
878
878
|
|
879
879
|
|
880
|
-
<code class="ruby"
|
880
|
+
<code class="ruby"></code>
|
881
881
|
</li>
|
882
882
|
|
883
883
|
<li class="missed" data-hits="0" data-linenumber="54">
|
884
884
|
|
885
885
|
|
886
|
-
<code class="ruby"> hash
|
886
|
+
<code class="ruby"> hash = {}</code>
|
887
887
|
</li>
|
888
888
|
|
889
889
|
<li class="missed" data-hits="0" data-linenumber="55">
|
890
890
|
|
891
891
|
|
892
|
-
<code class="ruby"> hash[:
|
892
|
+
<code class="ruby"> hash[:document_type] = response.employer_type</code>
|
893
893
|
</li>
|
894
894
|
|
895
895
|
<li class="missed" data-hits="0" data-linenumber="56">
|
896
896
|
|
897
897
|
|
898
|
-
<code class="ruby"> hash[:
|
898
|
+
<code class="ruby"> hash[:document_number] = response.employer_document</code>
|
899
899
|
</li>
|
900
900
|
|
901
901
|
<li class="missed" data-hits="0" data-linenumber="57">
|
902
902
|
|
903
903
|
|
904
|
-
<code class="ruby"> hash[:
|
904
|
+
<code class="ruby"> hash[:cei_document] = response.employer_cei</code>
|
905
905
|
</li>
|
906
906
|
|
907
907
|
<li class="missed" data-hits="0" data-linenumber="58">
|
908
908
|
|
909
909
|
|
910
|
-
<code class="ruby"
|
910
|
+
<code class="ruby"> hash[:company_name] = response.employer_name</code>
|
911
911
|
</li>
|
912
912
|
|
913
913
|
<li class="missed" data-hits="0" data-linenumber="59">
|
914
914
|
|
915
915
|
|
916
|
-
<code class="ruby"
|
916
|
+
<code class="ruby"></code>
|
917
917
|
</li>
|
918
918
|
|
919
919
|
<li class="missed" data-hits="0" data-linenumber="60">
|
920
920
|
|
921
921
|
|
922
|
-
<code class="ruby">
|
922
|
+
<code class="ruby"> return hash</code>
|
923
923
|
</li>
|
924
924
|
|
925
925
|
<li class="missed" data-hits="0" data-linenumber="61">
|
926
926
|
|
927
927
|
|
928
|
-
<code class="ruby"
|
928
|
+
<code class="ruby"> end</code>
|
929
929
|
</li>
|
930
930
|
|
931
931
|
<li class="missed" data-hits="0" data-linenumber="62">
|
932
932
|
|
933
933
|
|
934
|
-
<code class="ruby"
|
934
|
+
<code class="ruby"></code>
|
935
935
|
</li>
|
936
936
|
|
937
937
|
<li class="missed" data-hits="0" data-linenumber="63">
|
938
938
|
|
939
939
|
|
940
|
-
<code class="ruby">
|
940
|
+
<code class="ruby"> def get_serial_number</code>
|
941
941
|
</li>
|
942
942
|
|
943
943
|
<li class="missed" data-hits="0" data-linenumber="64">
|
944
944
|
|
945
945
|
|
946
|
-
<code class="ruby">
|
946
|
+
<code class="ruby"> command = CodinRep::GetAfdHeader.new(self.ip, self.tcp_port)</code>
|
947
947
|
</li>
|
948
948
|
|
949
949
|
<li class="missed" data-hits="0" data-linenumber="65">
|
950
950
|
|
951
951
|
|
952
|
-
<code class="ruby"> response.
|
952
|
+
<code class="ruby"> response = command.execute</code>
|
953
953
|
</li>
|
954
954
|
|
955
955
|
<li class="missed" data-hits="0" data-linenumber="66">
|
956
956
|
|
957
957
|
|
958
|
-
<code class="ruby">
|
958
|
+
<code class="ruby"> response.rep_serial_number</code>
|
959
959
|
</li>
|
960
960
|
|
961
961
|
<li class="missed" data-hits="0" data-linenumber="67">
|
962
962
|
|
963
963
|
|
964
|
-
<code class="ruby"
|
964
|
+
<code class="ruby"> end</code>
|
965
965
|
</li>
|
966
966
|
|
967
967
|
<li class="missed" data-hits="0" data-linenumber="68">
|
968
968
|
|
969
969
|
|
970
|
-
<code class="ruby"
|
970
|
+
<code class="ruby"></code>
|
971
971
|
</li>
|
972
972
|
|
973
973
|
<li class="missed" data-hits="0" data-linenumber="69">
|
974
974
|
|
975
975
|
|
976
|
-
<code class="ruby">
|
976
|
+
<code class="ruby"> def get_records(first_id=nil)</code>
|
977
977
|
</li>
|
978
978
|
|
979
979
|
<li class="missed" data-hits="0" data-linenumber="70">
|
980
980
|
|
981
981
|
|
982
|
-
<code class="ruby">
|
982
|
+
<code class="ruby"> command = CodinRep::GetRecords.new(first_id, self.ip, self.tcp_port)</code>
|
983
983
|
</li>
|
984
984
|
|
985
985
|
<li class="missed" data-hits="0" data-linenumber="71">
|
986
986
|
|
987
987
|
|
988
|
-
<code class="ruby"> response</code>
|
988
|
+
<code class="ruby"> response = command.execute</code>
|
989
989
|
</li>
|
990
990
|
|
991
991
|
<li class="missed" data-hits="0" data-linenumber="72">
|
992
992
|
|
993
993
|
|
994
|
-
<code class="ruby">
|
994
|
+
<code class="ruby"> response</code>
|
995
995
|
</li>
|
996
996
|
|
997
997
|
<li class="missed" data-hits="0" data-linenumber="73">
|
998
998
|
|
999
999
|
|
1000
|
-
<code class="ruby"
|
1000
|
+
<code class="ruby"> end</code>
|
1001
1001
|
</li>
|
1002
1002
|
|
1003
1003
|
<li class="missed" data-hits="0" data-linenumber="74">
|
1004
1004
|
|
1005
1005
|
|
1006
|
-
<code class="ruby"
|
1006
|
+
<code class="ruby"></code>
|
1007
1007
|
</li>
|
1008
1008
|
|
1009
1009
|
<li class="missed" data-hits="0" data-linenumber="75">
|
1010
1010
|
|
1011
1011
|
|
1012
|
-
<code class="ruby">
|
1012
|
+
<code class="ruby"> def set_employee(operation_type, registration, pis_number, name)</code>
|
1013
1013
|
</li>
|
1014
1014
|
|
1015
1015
|
<li class="missed" data-hits="0" data-linenumber="76">
|
1016
1016
|
|
1017
1017
|
|
1018
|
-
<code class="ruby">
|
1018
|
+
<code class="ruby"> if [:add, :edit].include? operation_type</code>
|
1019
1019
|
</li>
|
1020
1020
|
|
1021
1021
|
<li class="missed" data-hits="0" data-linenumber="77">
|
1022
1022
|
|
1023
1023
|
|
1024
|
-
<code class="ruby">
|
1024
|
+
<code class="ruby"> command = CodinRep::AddEmployee.new(registration, pis_number, name, self.ip, self.tcp_port)</code>
|
1025
1025
|
</li>
|
1026
1026
|
|
1027
1027
|
<li class="missed" data-hits="0" data-linenumber="78">
|
1028
1028
|
|
1029
1029
|
|
1030
|
-
<code class="ruby">
|
1030
|
+
<code class="ruby"> elsif operation_type == :remove</code>
|
1031
1031
|
</li>
|
1032
1032
|
|
1033
1033
|
<li class="missed" data-hits="0" data-linenumber="79">
|
1034
1034
|
|
1035
1035
|
|
1036
|
-
<code class="ruby">
|
1036
|
+
<code class="ruby"> command = CodinRep::DelEmployee.new(registration, self.ip, self.tcp_port)</code>
|
1037
1037
|
</li>
|
1038
1038
|
|
1039
1039
|
<li class="missed" data-hits="0" data-linenumber="80">
|
1040
1040
|
|
1041
1041
|
|
1042
|
-
<code class="ruby">
|
1042
|
+
<code class="ruby"> else</code>
|
1043
1043
|
</li>
|
1044
1044
|
|
1045
1045
|
<li class="missed" data-hits="0" data-linenumber="81">
|
1046
1046
|
|
1047
1047
|
|
1048
|
-
<code class="ruby">
|
1048
|
+
<code class="ruby"> raise EmployeeCommand::UnknownEmployeeOperation.new(operation_type)</code>
|
1049
1049
|
</li>
|
1050
1050
|
|
1051
1051
|
<li class="missed" data-hits="0" data-linenumber="82">
|
1052
1052
|
|
1053
1053
|
|
1054
|
-
<code class="ruby">
|
1054
|
+
<code class="ruby"> end</code>
|
1055
1055
|
</li>
|
1056
1056
|
|
1057
1057
|
<li class="missed" data-hits="0" data-linenumber="83">
|
1058
1058
|
|
1059
1059
|
|
1060
|
-
<code class="ruby"> response</code>
|
1060
|
+
<code class="ruby"> response = command.execute</code>
|
1061
1061
|
</li>
|
1062
1062
|
|
1063
1063
|
<li class="missed" data-hits="0" data-linenumber="84">
|
1064
1064
|
|
1065
1065
|
|
1066
|
-
<code class="ruby">
|
1066
|
+
<code class="ruby"> response</code>
|
1067
1067
|
</li>
|
1068
1068
|
|
1069
1069
|
<li class="missed" data-hits="0" data-linenumber="85">
|
1070
1070
|
|
1071
1071
|
|
1072
|
-
<code class="ruby">
|
1072
|
+
<code class="ruby"> end</code>
|
1073
1073
|
</li>
|
1074
1074
|
|
1075
1075
|
<li class="missed" data-hits="0" data-linenumber="86">
|
1076
1076
|
|
1077
1077
|
|
1078
|
+
<code class="ruby"> end</code>
|
1079
|
+
</li>
|
1080
|
+
|
1081
|
+
<li class="missed" data-hits="0" data-linenumber="87">
|
1082
|
+
|
1083
|
+
|
1078
1084
|
<code class="ruby">end</code>
|
1079
1085
|
</li>
|
1080
1086
|
|
@@ -3469,7 +3475,7 @@
|
|
3469
3475
|
<li class="missed" data-hits="0" data-linenumber="62">
|
3470
3476
|
|
3471
3477
|
|
3472
|
-
<code class="ruby"> sleep 0.
|
3478
|
+
<code class="ruby"> sleep 0.5</code>
|
3473
3479
|
</li>
|
3474
3480
|
|
3475
3481
|
<li class="missed" data-hits="0" data-linenumber="63">
|
@@ -4249,7 +4255,7 @@
|
|
4249
4255
|
<li class="missed" data-hits="0" data-linenumber="36">
|
4250
4256
|
|
4251
4257
|
|
4252
|
-
<code class="ruby"> START_COMMAND = "
|
4258
|
+
<code class="ruby"> START_COMMAND = "PGREP02890".freeze</code>
|
4253
4259
|
</li>
|
4254
4260
|
|
4255
4261
|
<li class="missed" data-hits="0" data-linenumber="37">
|
@@ -5311,7 +5317,7 @@
|
|
5311
5317
|
<li class="missed" data-hits="0" data-linenumber="54">
|
5312
5318
|
|
5313
5319
|
|
5314
|
-
<code class="ruby"> return [@time,
|
5320
|
+
<code class="ruby"> return [@time, Date.civil(1970,1,1), Date.civil(1970,1,1)]</code>
|
5315
5321
|
</li>
|
5316
5322
|
|
5317
5323
|
<li class="missed" data-hits="0" data-linenumber="55">
|
@@ -5341,9 +5347,9 @@
|
|
5341
5347
|
<h3>lib/codin_rep/mock_time_clock.rb</h3>
|
5342
5348
|
<h4><span class="red">0.0 %</span> covered</h4>
|
5343
5349
|
<div>
|
5344
|
-
<b>
|
5350
|
+
<b>194</b> relevant lines.
|
5345
5351
|
<span class="green"><b>0</b> lines covered</span> and
|
5346
|
-
<span class="red"><b>
|
5352
|
+
<span class="red"><b>194</b> lines missed.</span>
|
5347
5353
|
</div>
|
5348
5354
|
</div>
|
5349
5355
|
|
@@ -5737,361 +5743,361 @@
|
|
5737
5743
|
<li class="missed" data-hits="0" data-linenumber="65">
|
5738
5744
|
|
5739
5745
|
|
5740
|
-
<code class="ruby">
|
5746
|
+
<code class="ruby"> rescue EOFError => e</code>
|
5741
5747
|
</li>
|
5742
5748
|
|
5743
5749
|
<li class="missed" data-hits="0" data-linenumber="66">
|
5744
5750
|
|
5745
5751
|
|
5746
|
-
<code class="ruby">
|
5752
|
+
<code class="ruby"> # Ignore EOF errors, as only the client should close connections.</code>
|
5747
5753
|
</li>
|
5748
5754
|
|
5749
5755
|
<li class="missed" data-hits="0" data-linenumber="67">
|
5750
5756
|
|
5751
5757
|
|
5752
|
-
<code class="ruby">
|
5758
|
+
<code class="ruby"> ensure</code>
|
5753
5759
|
</li>
|
5754
5760
|
|
5755
5761
|
<li class="missed" data-hits="0" data-linenumber="68">
|
5756
5762
|
|
5757
5763
|
|
5758
|
-
<code class="ruby">
|
5764
|
+
<code class="ruby"> socket.close unless socket.closed?</code>
|
5759
5765
|
</li>
|
5760
5766
|
|
5761
5767
|
<li class="missed" data-hits="0" data-linenumber="69">
|
5762
5768
|
|
5763
5769
|
|
5764
|
-
<code class="ruby">
|
5770
|
+
<code class="ruby"> @threadsMutex.synchronize {</code>
|
5765
5771
|
</li>
|
5766
5772
|
|
5767
5773
|
<li class="missed" data-hits="0" data-linenumber="70">
|
5768
5774
|
|
5769
5775
|
|
5770
|
-
<code class="ruby">
|
5776
|
+
<code class="ruby"> @threads.delete(Thread.current)</code>
|
5771
5777
|
</li>
|
5772
5778
|
|
5773
5779
|
<li class="missed" data-hits="0" data-linenumber="71">
|
5774
5780
|
|
5775
5781
|
|
5776
|
-
<code class="ruby">
|
5782
|
+
<code class="ruby"> }</code>
|
5777
5783
|
</li>
|
5778
5784
|
|
5779
5785
|
<li class="missed" data-hits="0" data-linenumber="72">
|
5780
5786
|
|
5781
5787
|
|
5782
|
-
<code class="ruby">
|
5788
|
+
<code class="ruby"> end</code>
|
5783
5789
|
</li>
|
5784
5790
|
|
5785
5791
|
<li class="missed" data-hits="0" data-linenumber="73">
|
5786
5792
|
|
5787
5793
|
|
5788
|
-
<code class="ruby"
|
5794
|
+
<code class="ruby"> end</code>
|
5789
5795
|
</li>
|
5790
5796
|
|
5791
5797
|
<li class="missed" data-hits="0" data-linenumber="74">
|
5792
5798
|
|
5793
5799
|
|
5794
|
-
<code class="ruby">
|
5800
|
+
<code class="ruby"> end</code>
|
5795
5801
|
</li>
|
5796
5802
|
|
5797
5803
|
<li class="missed" data-hits="0" data-linenumber="75">
|
5798
5804
|
|
5799
5805
|
|
5800
|
-
<code class="ruby"
|
5806
|
+
<code class="ruby"></code>
|
5801
5807
|
</li>
|
5802
5808
|
|
5803
5809
|
<li class="missed" data-hits="0" data-linenumber="76">
|
5804
5810
|
|
5805
5811
|
|
5806
|
-
<code class="ruby">
|
5812
|
+
<code class="ruby"> def start</code>
|
5807
5813
|
</li>
|
5808
5814
|
|
5809
5815
|
<li class="missed" data-hits="0" data-linenumber="77">
|
5810
5816
|
|
5811
5817
|
|
5812
|
-
<code class="ruby">
|
5818
|
+
<code class="ruby"> @server_thread = Thread.new do</code>
|
5813
5819
|
</li>
|
5814
5820
|
|
5815
5821
|
<li class="missed" data-hits="0" data-linenumber="78">
|
5816
5822
|
|
5817
5823
|
|
5818
|
-
<code class="ruby">
|
5824
|
+
<code class="ruby"> Thread.current.abort_on_exception = true</code>
|
5819
5825
|
</li>
|
5820
5826
|
|
5821
5827
|
<li class="missed" data-hits="0" data-linenumber="79">
|
5822
5828
|
|
5823
5829
|
|
5824
|
-
<code class="ruby">
|
5830
|
+
<code class="ruby"> @running = true</code>
|
5825
5831
|
</li>
|
5826
5832
|
|
5827
5833
|
<li class="missed" data-hits="0" data-linenumber="80">
|
5828
5834
|
|
5829
5835
|
|
5830
|
-
<code class="ruby">
|
5836
|
+
<code class="ruby"> while @running</code>
|
5831
5837
|
</li>
|
5832
5838
|
|
5833
5839
|
<li class="missed" data-hits="0" data-linenumber="81">
|
5834
5840
|
|
5835
5841
|
|
5836
|
-
<code class="ruby">
|
5842
|
+
<code class="ruby"> break if @server.closed?</code>
|
5837
5843
|
</li>
|
5838
5844
|
|
5839
5845
|
<li class="missed" data-hits="0" data-linenumber="82">
|
5840
5846
|
|
5841
5847
|
|
5842
|
-
<code class="ruby">
|
5848
|
+
<code class="ruby"> socket = @server.accept</code>
|
5843
5849
|
</li>
|
5844
5850
|
|
5845
5851
|
<li class="missed" data-hits="0" data-linenumber="83">
|
5846
5852
|
|
5847
5853
|
|
5848
|
-
<code class="ruby">
|
5854
|
+
<code class="ruby"> serve(socket)</code>
|
5849
5855
|
</li>
|
5850
5856
|
|
5851
5857
|
<li class="missed" data-hits="0" data-linenumber="84">
|
5852
5858
|
|
5853
5859
|
|
5854
|
-
<code class="ruby">
|
5860
|
+
<code class="ruby"> end</code>
|
5855
5861
|
</li>
|
5856
5862
|
|
5857
5863
|
<li class="missed" data-hits="0" data-linenumber="85">
|
5858
5864
|
|
5859
5865
|
|
5860
|
-
<code class="ruby">
|
5866
|
+
<code class="ruby"> end</code>
|
5861
5867
|
</li>
|
5862
5868
|
|
5863
5869
|
<li class="missed" data-hits="0" data-linenumber="86">
|
5864
5870
|
|
5865
5871
|
|
5866
|
-
<code class="ruby"
|
5872
|
+
<code class="ruby"> self</code>
|
5867
5873
|
</li>
|
5868
5874
|
|
5869
5875
|
<li class="missed" data-hits="0" data-linenumber="87">
|
5870
5876
|
|
5871
5877
|
|
5872
|
-
<code class="ruby">
|
5878
|
+
<code class="ruby"> end</code>
|
5873
5879
|
</li>
|
5874
5880
|
|
5875
5881
|
<li class="missed" data-hits="0" data-linenumber="88">
|
5876
5882
|
|
5877
5883
|
|
5878
|
-
<code class="ruby"
|
5884
|
+
<code class="ruby"></code>
|
5879
5885
|
</li>
|
5880
5886
|
|
5881
5887
|
<li class="missed" data-hits="0" data-linenumber="89">
|
5882
5888
|
|
5883
5889
|
|
5884
|
-
<code class="ruby">
|
5890
|
+
<code class="ruby"> def stop</code>
|
5885
5891
|
</li>
|
5886
5892
|
|
5887
5893
|
<li class="missed" data-hits="0" data-linenumber="90">
|
5888
5894
|
|
5889
5895
|
|
5890
|
-
<code class="ruby">
|
5896
|
+
<code class="ruby"> @threadsMutex.synchronize {</code>
|
5891
5897
|
</li>
|
5892
5898
|
|
5893
5899
|
<li class="missed" data-hits="0" data-linenumber="91">
|
5894
5900
|
|
5895
5901
|
|
5896
|
-
<code class="ruby">
|
5902
|
+
<code class="ruby"> @threads.each{|thread| thread.kill}</code>
|
5897
5903
|
</li>
|
5898
5904
|
|
5899
5905
|
<li class="missed" data-hits="0" data-linenumber="92">
|
5900
5906
|
|
5901
5907
|
|
5902
|
-
<code class="ruby">
|
5908
|
+
<code class="ruby"> @threads = []</code>
|
5903
5909
|
</li>
|
5904
5910
|
|
5905
5911
|
<li class="missed" data-hits="0" data-linenumber="93">
|
5906
5912
|
|
5907
5913
|
|
5908
|
-
<code class="ruby">
|
5914
|
+
<code class="ruby"> }</code>
|
5909
5915
|
</li>
|
5910
5916
|
|
5911
5917
|
<li class="missed" data-hits="0" data-linenumber="94">
|
5912
5918
|
|
5913
5919
|
|
5914
|
-
<code class="ruby"> @server_thread.
|
5920
|
+
<code class="ruby"> @server_thread.kill if @server_thread</code>
|
5915
5921
|
</li>
|
5916
5922
|
|
5917
5923
|
<li class="missed" data-hits="0" data-linenumber="95">
|
5918
5924
|
|
5919
5925
|
|
5920
|
-
<code class="ruby"> @
|
5926
|
+
<code class="ruby"> @server.close unless @server.closed?</code>
|
5921
5927
|
</li>
|
5922
5928
|
|
5923
5929
|
<li class="missed" data-hits="0" data-linenumber="96">
|
5924
5930
|
|
5925
5931
|
|
5926
|
-
<code class="ruby">
|
5932
|
+
<code class="ruby"> @server_thread.join</code>
|
5927
5933
|
</li>
|
5928
5934
|
|
5929
5935
|
<li class="missed" data-hits="0" data-linenumber="97">
|
5930
5936
|
|
5931
5937
|
|
5932
|
-
<code class="ruby">
|
5938
|
+
<code class="ruby"> @running = false</code>
|
5933
5939
|
</li>
|
5934
5940
|
|
5935
5941
|
<li class="missed" data-hits="0" data-linenumber="98">
|
5936
5942
|
|
5937
5943
|
|
5938
|
-
<code class="ruby"
|
5944
|
+
<code class="ruby"> true</code>
|
5939
5945
|
</li>
|
5940
5946
|
|
5941
5947
|
<li class="missed" data-hits="0" data-linenumber="99">
|
5942
5948
|
|
5943
5949
|
|
5944
|
-
<code class="ruby">
|
5950
|
+
<code class="ruby"> end</code>
|
5945
5951
|
</li>
|
5946
5952
|
|
5947
5953
|
<li class="missed" data-hits="0" data-linenumber="100">
|
5948
5954
|
|
5949
5955
|
|
5950
|
-
<code class="ruby"
|
5956
|
+
<code class="ruby"></code>
|
5951
5957
|
</li>
|
5952
5958
|
|
5953
5959
|
<li class="missed" data-hits="0" data-linenumber="101">
|
5954
5960
|
|
5955
5961
|
|
5956
|
-
<code class="ruby">
|
5962
|
+
<code class="ruby"> def running?</code>
|
5957
5963
|
</li>
|
5958
5964
|
|
5959
5965
|
<li class="missed" data-hits="0" data-linenumber="102">
|
5960
5966
|
|
5961
5967
|
|
5962
|
-
<code class="ruby"
|
5968
|
+
<code class="ruby"> @running</code>
|
5963
5969
|
</li>
|
5964
5970
|
|
5965
5971
|
<li class="missed" data-hits="0" data-linenumber="103">
|
5966
5972
|
|
5967
5973
|
|
5968
|
-
<code class="ruby">
|
5974
|
+
<code class="ruby"> end</code>
|
5969
5975
|
</li>
|
5970
5976
|
|
5971
5977
|
<li class="missed" data-hits="0" data-linenumber="104">
|
5972
5978
|
|
5973
5979
|
|
5974
|
-
<code class="ruby"
|
5980
|
+
<code class="ruby"></code>
|
5975
5981
|
</li>
|
5976
5982
|
|
5977
5983
|
<li class="missed" data-hits="0" data-linenumber="105">
|
5978
5984
|
|
5979
5985
|
|
5980
|
-
<code class="ruby">
|
5986
|
+
<code class="ruby"> private</code>
|
5981
5987
|
</li>
|
5982
5988
|
|
5983
5989
|
<li class="missed" data-hits="0" data-linenumber="106">
|
5984
5990
|
|
5985
5991
|
|
5986
|
-
<code class="ruby">
|
5992
|
+
<code class="ruby"> def process_command(raw_command, socket)</code>
|
5987
5993
|
</li>
|
5988
5994
|
|
5989
5995
|
<li class="missed" data-hits="0" data-linenumber="107">
|
5990
5996
|
|
5991
5997
|
|
5992
|
-
<code class="ruby">
|
5998
|
+
<code class="ruby"> case raw_command</code>
|
5993
5999
|
</li>
|
5994
6000
|
|
5995
6001
|
<li class="missed" data-hits="0" data-linenumber="108">
|
5996
6002
|
|
5997
6003
|
|
5998
|
-
<code class="ruby"> when "
|
6004
|
+
<code class="ruby"> when "PGREP009b" # Get time</code>
|
5999
6005
|
</li>
|
6000
6006
|
|
6001
6007
|
<li class="missed" data-hits="0" data-linenumber="109">
|
6002
6008
|
|
6003
6009
|
|
6004
|
-
<code class="ruby">
|
6010
|
+
<code class="ruby"> response = 'REP008b' + get_timeclock_time</code>
|
6005
6011
|
</li>
|
6006
6012
|
|
6007
6013
|
<li class="missed" data-hits="0" data-linenumber="110">
|
6008
6014
|
|
6009
6015
|
|
6010
|
-
<code class="ruby">
|
6016
|
+
<code class="ruby"> when "PGREP016A" # Set time</code>
|
6011
6017
|
</li>
|
6012
6018
|
|
6013
6019
|
<li class="missed" data-hits="0" data-linenumber="111">
|
6014
6020
|
|
6015
6021
|
|
6016
|
-
<code class="ruby">
|
6022
|
+
<code class="ruby"> payload = read_from_socket_with_timeout(socket, 7)</code>
|
6017
6023
|
</li>
|
6018
6024
|
|
6019
6025
|
<li class="missed" data-hits="0" data-linenumber="112">
|
6020
6026
|
|
6021
6027
|
|
6022
|
-
<code class="ruby">
|
6028
|
+
<code class="ruby"> response = 'REP008A' + payload</code>
|
6023
6029
|
</li>
|
6024
6030
|
|
6025
6031
|
<li class="missed" data-hits="0" data-linenumber="113">
|
6026
6032
|
|
6027
6033
|
|
6028
|
-
<code class="ruby">
|
6034
|
+
<code class="ruby"> set_timeclock_time(payload)</code>
|
6029
6035
|
</li>
|
6030
6036
|
|
6031
6037
|
<li class="missed" data-hits="0" data-linenumber="114">
|
6032
6038
|
|
6033
6039
|
|
6034
|
-
<code class="ruby">
|
6040
|
+
<code class="ruby"> when "PGREP009Z"</code>
|
6035
6041
|
</li>
|
6036
6042
|
|
6037
6043
|
<li class="missed" data-hits="0" data-linenumber="115">
|
6038
6044
|
|
6039
6045
|
|
6040
|
-
<code class="ruby">
|
6046
|
+
<code class="ruby"> response = 'REP2359' + @data.afd.header.export + "\r\n"</code>
|
6041
6047
|
</li>
|
6042
6048
|
|
6043
6049
|
<li class="missed" data-hits="0" data-linenumber="116">
|
6044
6050
|
|
6045
6051
|
|
6046
|
-
<code class="ruby"> @
|
6052
|
+
<code class="ruby"> @keep_connected = false</code>
|
6047
6053
|
</li>
|
6048
6054
|
|
6049
6055
|
<li class="missed" data-hits="0" data-linenumber="117">
|
6050
6056
|
|
6051
6057
|
|
6052
|
-
<code class="ruby">
|
6058
|
+
<code class="ruby"> when "PGREP0289"</code>
|
6053
6059
|
</li>
|
6054
6060
|
|
6055
6061
|
<li class="missed" data-hits="0" data-linenumber="118">
|
6056
6062
|
|
6057
6063
|
|
6058
|
-
<code class="ruby">
|
6064
|
+
<code class="ruby"> byte = read_from_socket_with_timeout(socket, 1)</code>
|
6059
6065
|
</li>
|
6060
6066
|
|
6061
6067
|
<li class="missed" data-hits="0" data-linenumber="119">
|
6062
6068
|
|
6063
6069
|
|
6064
|
-
<code class="ruby">
|
6070
|
+
<code class="ruby"> if byte == "0"</code>
|
6065
6071
|
</li>
|
6066
6072
|
|
6067
6073
|
<li class="missed" data-hits="0" data-linenumber="120">
|
6068
6074
|
|
6069
6075
|
|
6070
|
-
<code class="ruby">
|
6076
|
+
<code class="ruby"> @afd_read_start_id = read_from_socket_with_timeout(socket, 9).to_i</code>
|
6071
6077
|
</li>
|
6072
6078
|
|
6073
6079
|
<li class="missed" data-hits="0" data-linenumber="121">
|
6074
6080
|
|
6075
6081
|
|
6076
|
-
<code class="ruby">
|
6082
|
+
<code class="ruby"> @afd_read_end_id = read_from_socket_with_timeout(socket, 9).to_i</code>
|
6077
6083
|
</li>
|
6078
6084
|
|
6079
6085
|
<li class="missed" data-hits="0" data-linenumber="122">
|
6080
6086
|
|
6081
6087
|
|
6082
|
-
<code class="ruby">
|
6088
|
+
<code class="ruby"> @afd_read_current_id = nil</code>
|
6083
6089
|
</li>
|
6084
6090
|
|
6085
6091
|
<li class="missed" data-hits="0" data-linenumber="123">
|
6086
6092
|
|
6087
6093
|
|
6088
|
-
<code class="ruby">
|
6094
|
+
<code class="ruby"> @afd_read_finished = false</code>
|
6089
6095
|
</li>
|
6090
6096
|
|
6091
6097
|
<li class="missed" data-hits="0" data-linenumber="124">
|
6092
6098
|
|
6093
6099
|
|
6094
|
-
<code class="ruby">
|
6100
|
+
<code class="ruby"> response = "REP0029["</code>
|
6095
6101
|
</li>
|
6096
6102
|
|
6097
6103
|
<li class="missed" data-hits="0" data-linenumber="125">
|
@@ -6103,145 +6109,145 @@
|
|
6103
6109
|
<li class="missed" data-hits="0" data-linenumber="126">
|
6104
6110
|
|
6105
6111
|
|
6106
|
-
<code class="ruby">
|
6112
|
+
<code class="ruby"> raw_command += byte</code>
|
6107
6113
|
</li>
|
6108
6114
|
|
6109
6115
|
<li class="missed" data-hits="0" data-linenumber="127">
|
6110
6116
|
|
6111
6117
|
|
6112
|
-
<code class="ruby">
|
6118
|
+
<code class="ruby"> raise StandardError.new("Unknown command \"#{raw_command}\"!")</code>
|
6113
6119
|
</li>
|
6114
6120
|
|
6115
6121
|
<li class="missed" data-hits="0" data-linenumber="128">
|
6116
6122
|
|
6117
6123
|
|
6118
|
-
<code class="ruby">
|
6124
|
+
<code class="ruby"> end</code>
|
6119
6125
|
</li>
|
6120
6126
|
|
6121
6127
|
<li class="missed" data-hits="0" data-linenumber="129">
|
6122
6128
|
|
6123
6129
|
|
6124
|
-
<code class="ruby">
|
6130
|
+
<code class="ruby"> when "PGREP009,"</code>
|
6125
6131
|
</li>
|
6126
6132
|
|
6127
6133
|
<li class="missed" data-hits="0" data-linenumber="130">
|
6128
6134
|
|
6129
6135
|
|
6130
|
-
<code class="ruby">
|
6136
|
+
<code class="ruby"> if @afd_read_finished</code>
|
6131
6137
|
</li>
|
6132
6138
|
|
6133
6139
|
<li class="missed" data-hits="0" data-linenumber="131">
|
6134
6140
|
|
6135
6141
|
|
6136
|
-
<code class="ruby">
|
6142
|
+
<code class="ruby"> response = "REP0029]"</code>
|
6137
6143
|
</li>
|
6138
6144
|
|
6139
6145
|
<li class="missed" data-hits="0" data-linenumber="132">
|
6140
6146
|
|
6141
6147
|
|
6142
|
-
<code class="ruby">
|
6148
|
+
<code class="ruby"> @keep_connected = false</code>
|
6143
6149
|
</li>
|
6144
6150
|
|
6145
6151
|
<li class="missed" data-hits="0" data-linenumber="133">
|
6146
6152
|
|
6147
6153
|
|
6148
|
-
<code class="ruby">
|
6154
|
+
<code class="ruby"> else</code>
|
6149
6155
|
</li>
|
6150
6156
|
|
6151
6157
|
<li class="missed" data-hits="0" data-linenumber="134">
|
6152
6158
|
|
6153
6159
|
|
6154
|
-
<code class="ruby">
|
6160
|
+
<code class="ruby"> if @afd_read_current_id.nil?</code>
|
6155
6161
|
</li>
|
6156
6162
|
|
6157
6163
|
<li class="missed" data-hits="0" data-linenumber="135">
|
6158
6164
|
|
6159
6165
|
|
6160
|
-
<code class="ruby">
|
6166
|
+
<code class="ruby"> @afd_read_current_id = @afd_read_start_id</code>
|
6161
6167
|
</li>
|
6162
6168
|
|
6163
6169
|
<li class="missed" data-hits="0" data-linenumber="136">
|
6164
6170
|
|
6165
6171
|
|
6166
|
-
<code class="ruby">
|
6172
|
+
<code class="ruby"> response = 'REP3029'</code>
|
6167
6173
|
</li>
|
6168
6174
|
|
6169
6175
|
<li class="missed" data-hits="0" data-linenumber="137">
|
6170
6176
|
|
6171
6177
|
|
6172
|
-
<code class="ruby">
|
6178
|
+
<code class="ruby"> elsif @afd_read_current_id == @afd_read_end_id or @afd_read_current_id >= @data.afd.records.size</code>
|
6173
6179
|
</li>
|
6174
6180
|
|
6175
6181
|
<li class="missed" data-hits="0" data-linenumber="138">
|
6176
6182
|
|
6177
6183
|
|
6178
|
-
<code class="ruby">
|
6184
|
+
<code class="ruby"> response = 'REP0909'</code>
|
6179
6185
|
</li>
|
6180
6186
|
|
6181
6187
|
<li class="missed" data-hits="0" data-linenumber="139">
|
6182
6188
|
|
6183
6189
|
|
6184
|
-
<code class="ruby">
|
6190
|
+
<code class="ruby"> @afd_read_finished = true</code>
|
6185
6191
|
</li>
|
6186
6192
|
|
6187
6193
|
<li class="missed" data-hits="0" data-linenumber="140">
|
6188
6194
|
|
6189
6195
|
|
6190
|
-
<code class="ruby">
|
6196
|
+
<code class="ruby"> else</code>
|
6191
6197
|
</li>
|
6192
6198
|
|
6193
6199
|
<li class="missed" data-hits="0" data-linenumber="141">
|
6194
6200
|
|
6195
6201
|
|
6196
|
-
<code class="ruby">
|
6202
|
+
<code class="ruby"> response = 'REP0379'</code>
|
6197
6203
|
</li>
|
6198
6204
|
|
6199
6205
|
<li class="missed" data-hits="0" data-linenumber="142">
|
6200
6206
|
|
6201
6207
|
|
6202
|
-
<code class="ruby">
|
6208
|
+
<code class="ruby"> end</code>
|
6203
6209
|
</li>
|
6204
6210
|
|
6205
6211
|
<li class="missed" data-hits="0" data-linenumber="143">
|
6206
6212
|
|
6207
6213
|
|
6208
|
-
<code class="ruby">
|
6214
|
+
<code class="ruby"> afd_records = ([@data.afd.header] + @data.afd.records)</code>
|
6209
6215
|
</li>
|
6210
6216
|
|
6211
6217
|
<li class="missed" data-hits="0" data-linenumber="144">
|
6212
6218
|
|
6213
6219
|
|
6214
|
-
<code class="ruby">
|
6220
|
+
<code class="ruby"> response += afd_records[@afd_read_current_id].export + "\r\n"</code>
|
6215
6221
|
</li>
|
6216
6222
|
|
6217
6223
|
<li class="missed" data-hits="0" data-linenumber="145">
|
6218
6224
|
|
6219
6225
|
|
6220
|
-
<code class="ruby">
|
6226
|
+
<code class="ruby"> end</code>
|
6221
6227
|
</li>
|
6222
6228
|
|
6223
6229
|
<li class="missed" data-hits="0" data-linenumber="146">
|
6224
6230
|
|
6225
6231
|
|
6226
|
-
<code class="ruby">
|
6232
|
+
<code class="ruby"> @afd_read_current_id += 1</code>
|
6227
6233
|
</li>
|
6228
6234
|
|
6229
6235
|
<li class="missed" data-hits="0" data-linenumber="147">
|
6230
6236
|
|
6231
6237
|
|
6232
|
-
<code class="ruby"> when "
|
6238
|
+
<code class="ruby"> when "PGREP075h"</code>
|
6233
6239
|
</li>
|
6234
6240
|
|
6235
6241
|
<li class="missed" data-hits="0" data-linenumber="148">
|
6236
6242
|
|
6237
6243
|
|
6238
|
-
<code class="ruby"> payload = read_from_socket_with_timeout(socket,
|
6244
|
+
<code class="ruby"> payload = read_from_socket_with_timeout(socket, 66)</code>
|
6239
6245
|
</li>
|
6240
6246
|
|
6241
6247
|
<li class="missed" data-hits="0" data-linenumber="149">
|
6242
6248
|
|
6243
6249
|
|
6244
|
-
<code class="ruby"> raw_registration = payload.scan(/.(.{6})/).flatten
|
6250
|
+
<code class="ruby"> raw_registration, raw_pis, raw_name = payload.scan(/.(.{6})(.{6})(.+)/).flatten</code>
|
6245
6251
|
</li>
|
6246
6252
|
|
6247
6253
|
<li class="missed" data-hits="0" data-linenumber="150">
|
@@ -6253,216 +6259,264 @@
|
|
6253
6259
|
<li class="missed" data-hits="0" data-linenumber="151">
|
6254
6260
|
|
6255
6261
|
|
6256
|
-
<code class="ruby">
|
6262
|
+
<code class="ruby"> pis = convert_bytes_to_string(raw_pis)</code>
|
6257
6263
|
</li>
|
6258
6264
|
|
6259
6265
|
<li class="missed" data-hits="0" data-linenumber="152">
|
6260
6266
|
|
6261
6267
|
|
6262
|
-
<code class="ruby">
|
6268
|
+
<code class="ruby"> name = raw_name.strip</code>
|
6263
6269
|
</li>
|
6264
6270
|
|
6265
6271
|
<li class="missed" data-hits="0" data-linenumber="153">
|
6266
6272
|
|
6267
6273
|
|
6268
|
-
<code class="ruby">
|
6274
|
+
<code class="ruby"> @data.employees << {name: name, pis: pis, registration: registration}</code>
|
6269
6275
|
</li>
|
6270
6276
|
|
6271
6277
|
<li class="missed" data-hits="0" data-linenumber="154">
|
6272
6278
|
|
6273
6279
|
|
6274
|
-
<code class="ruby">
|
6280
|
+
<code class="ruby"> response = "REP003h1\0"</code>
|
6275
6281
|
</li>
|
6276
6282
|
|
6277
6283
|
<li class="missed" data-hits="0" data-linenumber="155">
|
6278
6284
|
|
6279
6285
|
|
6280
|
-
<code class="ruby">
|
6286
|
+
<code class="ruby"> when "PGREP016j"</code>
|
6281
6287
|
</li>
|
6282
6288
|
|
6283
6289
|
<li class="missed" data-hits="0" data-linenumber="156">
|
6284
6290
|
|
6285
6291
|
|
6286
|
-
<code class="ruby">
|
6292
|
+
<code class="ruby"> payload = read_from_socket_with_timeout(socket, 7)</code>
|
6287
6293
|
</li>
|
6288
6294
|
|
6289
6295
|
<li class="missed" data-hits="0" data-linenumber="157">
|
6290
6296
|
|
6291
6297
|
|
6292
|
-
<code class="ruby">
|
6298
|
+
<code class="ruby"> raw_registration = payload.scan(/.(.{6})/).flatten[0]</code>
|
6293
6299
|
</li>
|
6294
6300
|
|
6295
6301
|
<li class="missed" data-hits="0" data-linenumber="158">
|
6296
6302
|
|
6297
6303
|
|
6298
|
-
<code class="ruby">
|
6304
|
+
<code class="ruby"> registration = convert_bytes_to_string(raw_registration)</code>
|
6299
6305
|
</li>
|
6300
6306
|
|
6301
6307
|
<li class="missed" data-hits="0" data-linenumber="159">
|
6302
6308
|
|
6303
6309
|
|
6304
|
-
<code class="ruby">
|
6310
|
+
<code class="ruby"> @data.employees.delete_if{|employee| employee[:registration] == registration}</code>
|
6305
6311
|
</li>
|
6306
6312
|
|
6307
6313
|
<li class="missed" data-hits="0" data-linenumber="160">
|
6308
6314
|
|
6309
6315
|
|
6310
|
-
<code class="ruby">
|
6316
|
+
<code class="ruby"> response = "REP003j1\0"</code>
|
6311
6317
|
</li>
|
6312
6318
|
|
6313
6319
|
<li class="missed" data-hits="0" data-linenumber="161">
|
6314
6320
|
|
6315
6321
|
|
6316
|
-
<code class="ruby">
|
6322
|
+
<code class="ruby"> when 'PGREP010h', 'PGREP010j'</code>
|
6317
6323
|
</li>
|
6318
6324
|
|
6319
6325
|
<li class="missed" data-hits="0" data-linenumber="162">
|
6320
6326
|
|
6321
6327
|
|
6322
|
-
<code class="ruby">
|
6328
|
+
<code class="ruby"> # Don't care for the result of these comands, just disconnect when</code>
|
6323
6329
|
</li>
|
6324
6330
|
|
6325
6331
|
<li class="missed" data-hits="0" data-linenumber="163">
|
6326
6332
|
|
6327
6333
|
|
6328
|
-
<code class="ruby"
|
6334
|
+
<code class="ruby"> # possible.</code>
|
6329
6335
|
</li>
|
6330
6336
|
|
6331
6337
|
<li class="missed" data-hits="0" data-linenumber="164">
|
6332
6338
|
|
6333
6339
|
|
6334
|
-
<code class="ruby">
|
6340
|
+
<code class="ruby"> @keep_connected = false</code>
|
6335
6341
|
</li>
|
6336
6342
|
|
6337
6343
|
<li class="missed" data-hits="0" data-linenumber="165">
|
6338
6344
|
|
6339
6345
|
|
6340
|
-
<code class="ruby">
|
6346
|
+
<code class="ruby"> response = ""</code>
|
6341
6347
|
</li>
|
6342
6348
|
|
6343
6349
|
<li class="missed" data-hits="0" data-linenumber="166">
|
6344
6350
|
|
6345
6351
|
|
6346
|
-
<code class="ruby">
|
6352
|
+
<code class="ruby"> else</code>
|
6347
6353
|
</li>
|
6348
6354
|
|
6349
6355
|
<li class="missed" data-hits="0" data-linenumber="167">
|
6350
6356
|
|
6351
6357
|
|
6352
|
-
<code class="ruby">
|
6358
|
+
<code class="ruby"> raise StandardError.new("Unknown command \"#{raw_command}\"!")</code>
|
6353
6359
|
</li>
|
6354
6360
|
|
6355
6361
|
<li class="missed" data-hits="0" data-linenumber="168">
|
6356
6362
|
|
6357
6363
|
|
6358
|
-
<code class="ruby">
|
6364
|
+
<code class="ruby"> end</code>
|
6359
6365
|
</li>
|
6360
6366
|
|
6361
6367
|
<li class="missed" data-hits="0" data-linenumber="169">
|
6362
6368
|
|
6363
6369
|
|
6364
|
-
<code class="ruby">
|
6370
|
+
<code class="ruby"> response</code>
|
6365
6371
|
</li>
|
6366
6372
|
|
6367
6373
|
<li class="missed" data-hits="0" data-linenumber="170">
|
6368
6374
|
|
6369
6375
|
|
6370
|
-
<code class="ruby"
|
6376
|
+
<code class="ruby"> end</code>
|
6371
6377
|
</li>
|
6372
6378
|
|
6373
6379
|
<li class="missed" data-hits="0" data-linenumber="171">
|
6374
6380
|
|
6375
6381
|
|
6376
|
-
<code class="ruby"
|
6382
|
+
<code class="ruby"></code>
|
6377
6383
|
</li>
|
6378
6384
|
|
6379
6385
|
<li class="missed" data-hits="0" data-linenumber="172">
|
6380
6386
|
|
6381
6387
|
|
6382
|
-
<code class="ruby">
|
6388
|
+
<code class="ruby"> def read_from_socket_with_timeout(socket, bytes_to_be_read, timeout_value=5)</code>
|
6383
6389
|
</li>
|
6384
6390
|
|
6385
6391
|
<li class="missed" data-hits="0" data-linenumber="173">
|
6386
6392
|
|
6387
6393
|
|
6388
|
-
<code class="ruby">
|
6394
|
+
<code class="ruby"> data_to_receive = nil</code>
|
6389
6395
|
</li>
|
6390
6396
|
|
6391
6397
|
<li class="missed" data-hits="0" data-linenumber="174">
|
6392
6398
|
|
6393
6399
|
|
6394
|
-
<code class="ruby">
|
6400
|
+
<code class="ruby"> timeout_value = 600 if @first_connection # use a large timeout on first connection</code>
|
6395
6401
|
</li>
|
6396
6402
|
|
6397
6403
|
<li class="missed" data-hits="0" data-linenumber="175">
|
6398
6404
|
|
6399
6405
|
|
6400
|
-
<code class="ruby"
|
6406
|
+
<code class="ruby"> timeout(timeout_value) { data_to_receive = socket.readpartial( bytes_to_be_read ) }</code>
|
6401
6407
|
</li>
|
6402
6408
|
|
6403
6409
|
<li class="missed" data-hits="0" data-linenumber="176">
|
6404
6410
|
|
6405
6411
|
|
6406
|
-
<code class="ruby">
|
6412
|
+
<code class="ruby"> return data_to_receive</code>
|
6407
6413
|
</li>
|
6408
6414
|
|
6409
6415
|
<li class="missed" data-hits="0" data-linenumber="177">
|
6410
6416
|
|
6411
6417
|
|
6412
|
-
<code class="ruby">
|
6418
|
+
<code class="ruby"> end</code>
|
6413
6419
|
</li>
|
6414
6420
|
|
6415
6421
|
<li class="missed" data-hits="0" data-linenumber="178">
|
6416
6422
|
|
6417
6423
|
|
6418
|
-
<code class="ruby"
|
6424
|
+
<code class="ruby"></code>
|
6419
6425
|
</li>
|
6420
6426
|
|
6421
6427
|
<li class="missed" data-hits="0" data-linenumber="179">
|
6422
6428
|
|
6423
6429
|
|
6424
|
-
<code class="ruby">
|
6430
|
+
<code class="ruby"> def get_timeclock_time(current_time=nil)</code>
|
6425
6431
|
</li>
|
6426
6432
|
|
6427
6433
|
<li class="missed" data-hits="0" data-linenumber="180">
|
6428
6434
|
|
6429
6435
|
|
6430
|
-
<code class="ruby">
|
6436
|
+
<code class="ruby"> current_time ||= @data.time</code>
|
6431
6437
|
</li>
|
6432
6438
|
|
6433
6439
|
<li class="missed" data-hits="0" data-linenumber="181">
|
6434
6440
|
|
6435
6441
|
|
6436
|
-
<code class="ruby"
|
6442
|
+
<code class="ruby"> CodinRep::TimeUtil.pack current_time</code>
|
6437
6443
|
</li>
|
6438
6444
|
|
6439
6445
|
<li class="missed" data-hits="0" data-linenumber="182">
|
6440
6446
|
|
6441
6447
|
|
6442
|
-
<code class="ruby">
|
6448
|
+
<code class="ruby"> end</code>
|
6443
6449
|
</li>
|
6444
6450
|
|
6445
6451
|
<li class="missed" data-hits="0" data-linenumber="183">
|
6446
6452
|
|
6447
6453
|
|
6448
|
-
<code class="ruby"
|
6454
|
+
<code class="ruby"></code>
|
6449
6455
|
</li>
|
6450
6456
|
|
6451
6457
|
<li class="missed" data-hits="0" data-linenumber="184">
|
6452
6458
|
|
6453
6459
|
|
6454
|
-
<code class="ruby">
|
6460
|
+
<code class="ruby"> def set_timeclock_time(payload)</code>
|
6455
6461
|
</li>
|
6456
6462
|
|
6457
6463
|
<li class="missed" data-hits="0" data-linenumber="185">
|
6458
6464
|
|
6459
6465
|
|
6460
|
-
<code class="ruby">
|
6466
|
+
<code class="ruby"> time = CodinRep::TimeUtil.unpack payload</code>
|
6461
6467
|
</li>
|
6462
6468
|
|
6463
6469
|
<li class="missed" data-hits="0" data-linenumber="186">
|
6464
6470
|
|
6465
6471
|
|
6472
|
+
<code class="ruby"> @data.time = time</code>
|
6473
|
+
</li>
|
6474
|
+
|
6475
|
+
<li class="missed" data-hits="0" data-linenumber="187">
|
6476
|
+
|
6477
|
+
|
6478
|
+
<code class="ruby"> return time</code>
|
6479
|
+
</li>
|
6480
|
+
|
6481
|
+
<li class="missed" data-hits="0" data-linenumber="188">
|
6482
|
+
|
6483
|
+
|
6484
|
+
<code class="ruby"> end</code>
|
6485
|
+
</li>
|
6486
|
+
|
6487
|
+
<li class="missed" data-hits="0" data-linenumber="189">
|
6488
|
+
|
6489
|
+
|
6490
|
+
<code class="ruby"></code>
|
6491
|
+
</li>
|
6492
|
+
|
6493
|
+
<li class="missed" data-hits="0" data-linenumber="190">
|
6494
|
+
|
6495
|
+
|
6496
|
+
<code class="ruby"> def convert_bytes_to_string(bytes)</code>
|
6497
|
+
</li>
|
6498
|
+
|
6499
|
+
<li class="missed" data-hits="0" data-linenumber="191">
|
6500
|
+
|
6501
|
+
|
6502
|
+
<code class="ruby"> bytes.unpack('H*')[0]</code>
|
6503
|
+
</li>
|
6504
|
+
|
6505
|
+
<li class="missed" data-hits="0" data-linenumber="192">
|
6506
|
+
|
6507
|
+
|
6508
|
+
<code class="ruby"> end</code>
|
6509
|
+
</li>
|
6510
|
+
|
6511
|
+
<li class="missed" data-hits="0" data-linenumber="193">
|
6512
|
+
|
6513
|
+
|
6514
|
+
<code class="ruby"> end</code>
|
6515
|
+
</li>
|
6516
|
+
|
6517
|
+
<li class="missed" data-hits="0" data-linenumber="194">
|
6518
|
+
|
6519
|
+
|
6466
6520
|
<code class="ruby">end</code>
|
6467
6521
|
</li>
|
6468
6522
|
|
@@ -7321,7 +7375,7 @@
|
|
7321
7375
|
<li class="covered" data-hits="1" data-linenumber="22">
|
7322
7376
|
<span class="hits">1</span>
|
7323
7377
|
|
7324
|
-
<code class="ruby"> VERSION = "0.2.
|
7378
|
+
<code class="ruby"> VERSION = "0.2.5".freeze</code>
|
7325
7379
|
</li>
|
7326
7380
|
|
7327
7381
|
<li class="never" data-hits="" data-linenumber="23">
|