codin_rep 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -46,14 +46,14 @@
46
46
  <tfoot>
47
47
  <tr>
48
48
  <td class="left_align">TOTAL</td>
49
- <td class='right_align'><tt>902</tt></td>
50
- <td class='right_align'><tt>881</tt></td>
51
- <td class="left_align"><div class="percent_graph_legend"><tt class=''>2.55%</tt></div>
49
+ <td class='right_align'><tt>1088</tt></td>
50
+ <td class='right_align'><tt>1067</tt></td>
51
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>2.11%</tt></div>
52
52
  <div class="percent_graph">
53
- <div class="covered" style="width:3px"></div>
54
- <div class="uncovered" style="width:97px"></div>
53
+ <div class="covered" style="width:2px"></div>
54
+ <div class="uncovered" style="width:98px"></div>
55
55
  </div></td>
56
- <td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>0.23%</tt></div>
56
+ <td class="left_align"><div class="percent_graph_legend"><tt class='coverage_total'>0.19%</tt></div>
57
57
  <div class="percent_graph">
58
58
  <div class="covered" style="width:0px"></div>
59
59
  <div class="uncovered" style="width:100px"></div>
@@ -207,6 +207,22 @@
207
207
  </tr>
208
208
 
209
209
  <tr class="all_files all_coverage 10 20 30 40 50 60 70 80 90 100 lib codin_rep odd">
210
+ <td class="left_align"><a href="lib-codin_rep-mock_time_clock_rb.html">lib/codin_rep/mock_time_clock.rb</a></td>
211
+ <td class='right_align'><tt>186</tt></td>
212
+ <td class='right_align'><tt>186</tt></td>
213
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>0.00%</tt></div>
214
+ <div class="percent_graph">
215
+ <div class="covered" style="width:0px"></div>
216
+ <div class="uncovered" style="width:100px"></div>
217
+ </div></td>
218
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>0.00%</tt></div>
219
+ <div class="percent_graph">
220
+ <div class="covered" style="width:0px"></div>
221
+ <div class="uncovered" style="width:100px"></div>
222
+ </div></td>
223
+ </tr>
224
+
225
+ <tr class="all_files all_coverage 10 20 30 40 50 60 70 80 90 100 lib codin_rep even">
210
226
  <td class="left_align"><a href="lib-codin_rep-set_time_rb.html">lib/codin_rep/set_time.rb</a></td>
211
227
  <td class='right_align'><tt>61</tt></td>
212
228
  <td class='right_align'><tt>61</tt></td>
@@ -222,7 +238,7 @@
222
238
  </div></td>
223
239
  </tr>
224
240
 
225
- <tr class="all_files all_coverage 10 20 30 40 50 60 70 80 90 100 lib codin_rep even">
241
+ <tr class="all_files all_coverage 10 20 30 40 50 60 70 80 90 100 lib codin_rep odd">
226
242
  <td class="left_align"><a href="lib-codin_rep-time_util_rb.html">lib/codin_rep/time_util.rb</a></td>
227
243
  <td class='right_align'><tt>51</tt></td>
228
244
  <td class='right_align'><tt>51</tt></td>
@@ -238,7 +254,7 @@
238
254
  </div></td>
239
255
  </tr>
240
256
 
241
- <tr class="all_files all_coverage 110 lib codin_rep odd">
257
+ <tr class="all_files all_coverage 110 lib codin_rep even">
242
258
  <td class="left_align"><a href="lib-codin_rep-version_rb.html">lib/codin_rep/version.rb</a></td>
243
259
  <td class='right_align'><tt>23</tt></td>
244
260
  <td class='right_align'><tt>2</tt></td>
@@ -258,7 +274,7 @@
258
274
  </table>
259
275
  </div>
260
276
 
261
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
277
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
262
278
 
263
279
  <script type="text/javascript">
264
280
  $(document).ready(function(){$("#report_table").tablesorter({widgets: ['zebra'], textExtraction: 'complex'});});
@@ -194,7 +194,7 @@
194
194
  </tbody>
195
195
  </table>
196
196
 
197
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
197
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
198
198
 
199
199
  </body>
200
200
  </html>
@@ -392,7 +392,7 @@
392
392
  </tbody>
393
393
  </table>
394
394
 
395
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
395
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
396
396
 
397
397
  </body>
398
398
  </html>
@@ -425,7 +425,7 @@
425
425
  </tbody>
426
426
  </table>
427
427
 
428
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
428
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
429
429
 
430
430
  </body>
431
431
  </html>
@@ -167,7 +167,7 @@
167
167
  </tbody>
168
168
  </table>
169
169
 
170
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
170
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
171
171
 
172
172
  </body>
173
173
  </html>
@@ -332,7 +332,7 @@
332
332
  </tbody>
333
333
  </table>
334
334
 
335
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
335
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
336
336
 
337
337
  </body>
338
338
  </html>
@@ -212,7 +212,7 @@
212
212
  </tbody>
213
213
  </table>
214
214
 
215
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
215
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
216
216
 
217
217
  </body>
218
218
  </html>
@@ -521,7 +521,7 @@
521
521
  </tbody>
522
522
  </table>
523
523
 
524
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
524
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
525
525
 
526
526
  </body>
527
527
  </html>
@@ -224,7 +224,7 @@
224
224
  </tbody>
225
225
  </table>
226
226
 
227
- <p>Generated on 2017-01-19 17:18:28 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
227
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
228
228
 
229
229
  </body>
230
230
  </html>
@@ -0,0 +1,617 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>lib/codin_rep/mock_time_clock.rb</title>
5
+ <link href="./assets/0.2.3/screen.css" media="all" rel="stylesheet" type="text/css" />
6
+ <link href="./assets/0.2.3/print.css" media="print" rel="stylesheet" type="text/css" />
7
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
8
+ <script type="text/javascript" src="./assets/0.2.3/rcov.js"></script>
9
+ </head>
10
+ <body>
11
+ <h1>Src C0 Coverage Information - Simploco - RCov</h1>
12
+ <h2>lib/codin_rep/mock_time_clock.rb</h2>
13
+
14
+ <div class="report_table_wrapper">
15
+ <table class='report' id='report_table'>
16
+ <thead>
17
+ <tr>
18
+ <th class="left_align">Name</th>
19
+ <th class="right_align">Total Lines</th>
20
+ <th class="right_align">Lines of Code</th>
21
+ <th class="left_align">Total Coverage</th>
22
+ <th class="left_align">Code Coverage</th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <tr>
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>186</tt></td>
29
+ <td class='right_align'><tt>186</tt></td>
30
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>0.00%</tt></div>
31
+ <div class="percent_graph">
32
+ <div class="covered" style="width:0px"></div>
33
+ <div class="uncovered" style="width:100px"></div>
34
+ </div></td>
35
+ <td class="left_align"><div class="percent_graph_legend"><tt class=''>0.00%</tt></div>
36
+ <div class="percent_graph">
37
+ <div class="covered" style="width:0px"></div>
38
+ <div class="uncovered" style="width:100px"></div>
39
+ </div></td>
40
+ </tr>
41
+ </tbody>
42
+ </table>
43
+ </div>
44
+
45
+ <h3>Key</h3>
46
+
47
+ <div class="key"><pre><span class='marked'>Code reported as executed by Ruby looks like this...</span><span class='marked1'>and this: this line is also marked as covered.</span><span class='inferred'>Lines considered as run by rcov, but not reported by Ruby, look like this,</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).</span><span class='uncovered'>Finally, here's a line marked as not executed.</span></pre></div>
48
+
49
+ <h3>Coverage Details</h3>
50
+
51
+ <table class="details">
52
+ <tbody>
53
+ <tr class="uncovered">
54
+ <td><pre><a name="line2">2</a> # -*- coding: utf-8 -*-</pre></td>
55
+ </tr>
56
+ <tr class="uncovered">
57
+ <td><pre><a name="line3">3</a> # codin_rep - Gem para acesso de REPs da Telebyte</pre></td>
58
+ </tr>
59
+ <tr class="uncovered">
60
+ <td><pre><a name="line4">4</a> # Copyright (C) 2016 O.S. Systems Softwares Ltda.</pre></td>
61
+ </tr>
62
+ <tr class="uncovered">
63
+ <td><pre><a name="line5">5</a> </pre></td>
64
+ </tr>
65
+ <tr class="uncovered">
66
+ <td><pre><a name="line6">6</a> # This program is free software: you can redistribute it and/or modify</pre></td>
67
+ </tr>
68
+ <tr class="uncovered">
69
+ <td><pre><a name="line7">7</a> # it under the terms of the GNU Affero General Public License as</pre></td>
70
+ </tr>
71
+ <tr class="uncovered">
72
+ <td><pre><a name="line8">8</a> # published by the Free Software Foundation, either version 3 of the</pre></td>
73
+ </tr>
74
+ <tr class="uncovered">
75
+ <td><pre><a name="line9">9</a> # License, or (at your option) any later version.</pre></td>
76
+ </tr>
77
+ <tr class="uncovered">
78
+ <td><pre><a name="line10">10</a> </pre></td>
79
+ </tr>
80
+ <tr class="uncovered">
81
+ <td><pre><a name="line11">11</a> # This program is distributed in the hope that it will be useful,</pre></td>
82
+ </tr>
83
+ <tr class="uncovered">
84
+ <td><pre><a name="line12">12</a> # but WITHOUT ANY WARRANTY; without even the implied warranty of</pre></td>
85
+ </tr>
86
+ <tr class="uncovered">
87
+ <td><pre><a name="line13">13</a> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</pre></td>
88
+ </tr>
89
+ <tr class="uncovered">
90
+ <td><pre><a name="line14">14</a> # GNU Affero General Public License for more details.</pre></td>
91
+ </tr>
92
+ <tr class="uncovered">
93
+ <td><pre><a name="line15">15</a> </pre></td>
94
+ </tr>
95
+ <tr class="uncovered">
96
+ <td><pre><a name="line16">16</a> # You should have received a copy of the GNU Affero General Public License</pre></td>
97
+ </tr>
98
+ <tr class="uncovered">
99
+ <td><pre><a name="line17">17</a> # along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.</pre></td>
100
+ </tr>
101
+ <tr class="uncovered">
102
+ <td><pre><a name="line18">18</a> </pre></td>
103
+ </tr>
104
+ <tr class="uncovered">
105
+ <td><pre><a name="line19">19</a> # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil.</pre></td>
106
+ </tr>
107
+ <tr class="uncovered">
108
+ <td><pre><a name="line20">20</a> # e-mail: contato@ossystems.com.br</pre></td>
109
+ </tr>
110
+ <tr class="uncovered">
111
+ <td><pre><a name="line21">21</a> </pre></td>
112
+ </tr>
113
+ <tr class="uncovered">
114
+ <td><pre><a name="line22">22</a> require &#39;codin_rep&#39;</pre></td>
115
+ </tr>
116
+ <tr class="uncovered">
117
+ <td><pre><a name="line23">23</a> require &#39;codin_rep/time_util&#39;</pre></td>
118
+ </tr>
119
+ <tr class="uncovered">
120
+ <td><pre><a name="line24">24</a> require &#39;socket&#39;</pre></td>
121
+ </tr>
122
+ <tr class="uncovered">
123
+ <td><pre><a name="line25">25</a> </pre></td>
124
+ </tr>
125
+ <tr class="uncovered">
126
+ <td><pre><a name="line26">26</a> module CodinRep</pre></td>
127
+ </tr>
128
+ <tr class="uncovered">
129
+ <td><pre><a name="line27">27</a> class MockTimeClock</pre></td>
130
+ </tr>
131
+ <tr class="uncovered">
132
+ <td><pre><a name="line28">28</a> include CodinRep</pre></td>
133
+ </tr>
134
+ <tr class="uncovered">
135
+ <td><pre><a name="line29">29</a> </pre></td>
136
+ </tr>
137
+ <tr class="uncovered">
138
+ <td><pre><a name="line30">30</a> attr_reader :data, :ip</pre></td>
139
+ </tr>
140
+ <tr class="uncovered">
141
+ <td><pre><a name="line31">31</a> </pre></td>
142
+ </tr>
143
+ <tr class="uncovered">
144
+ <td><pre><a name="line32">32</a> def initialize</pre></td>
145
+ </tr>
146
+ <tr class="uncovered">
147
+ <td><pre><a name="line33">33</a> @data = OpenStruct.new</pre></td>
148
+ </tr>
149
+ <tr class="uncovered">
150
+ <td><pre><a name="line34">34</a> @ip = &#39;127.0.0.1&#39;</pre></td>
151
+ </tr>
152
+ <tr class="uncovered">
153
+ <td><pre><a name="line35">35</a> @server = TCPServer.new(@ip, 0)</pre></td>
154
+ </tr>
155
+ <tr class="uncovered">
156
+ <td><pre><a name="line36">36</a> @running = false</pre></td>
157
+ </tr>
158
+ <tr class="uncovered">
159
+ <td><pre><a name="line37">37</a> @served_connections = 0</pre></td>
160
+ </tr>
161
+ <tr class="uncovered">
162
+ <td><pre><a name="line38">38</a> @threads = []</pre></td>
163
+ </tr>
164
+ <tr class="uncovered">
165
+ <td><pre><a name="line39">39</a> @threadsMutex = Mutex.new</pre></td>
166
+ </tr>
167
+ <tr class="uncovered">
168
+ <td><pre><a name="line40">40</a> @served_connections = 0</pre></td>
169
+ </tr>
170
+ <tr class="uncovered">
171
+ <td><pre><a name="line41">41</a> @time = true</pre></td>
172
+ </tr>
173
+ <tr class="uncovered">
174
+ <td><pre><a name="line42">42</a> @is_sending_records = false</pre></td>
175
+ </tr>
176
+ <tr class="uncovered">
177
+ <td><pre><a name="line43">43</a> end</pre></td>
178
+ </tr>
179
+ <tr class="uncovered">
180
+ <td><pre><a name="line44">44</a> </pre></td>
181
+ </tr>
182
+ <tr class="uncovered">
183
+ <td><pre><a name="line45">45</a> def tcp_port</pre></td>
184
+ </tr>
185
+ <tr class="uncovered">
186
+ <td><pre><a name="line46">46</a> @server.addr[1]</pre></td>
187
+ </tr>
188
+ <tr class="uncovered">
189
+ <td><pre><a name="line47">47</a> end</pre></td>
190
+ </tr>
191
+ <tr class="uncovered">
192
+ <td><pre><a name="line48">48</a> </pre></td>
193
+ </tr>
194
+ <tr class="uncovered">
195
+ <td><pre><a name="line49">49</a> def serve(socket)</pre></td>
196
+ </tr>
197
+ <tr class="uncovered">
198
+ <td><pre><a name="line50">50</a> Thread.new do</pre></td>
199
+ </tr>
200
+ <tr class="uncovered">
201
+ <td><pre><a name="line51">51</a> Thread.current.abort_on_exception = true</pre></td>
202
+ </tr>
203
+ <tr class="uncovered">
204
+ <td><pre><a name="line52">52</a> @threadsMutex.synchronize {</pre></td>
205
+ </tr>
206
+ <tr class="uncovered">
207
+ <td><pre><a name="line53">53</a> @threads &lt;&lt; Thread.current</pre></td>
208
+ </tr>
209
+ <tr class="uncovered">
210
+ <td><pre><a name="line54">54</a> @served_connections += 1</pre></td>
211
+ </tr>
212
+ <tr class="uncovered">
213
+ <td><pre><a name="line55">55</a> }</pre></td>
214
+ </tr>
215
+ <tr class="uncovered">
216
+ <td><pre><a name="line56">56</a> begin</pre></td>
217
+ </tr>
218
+ <tr class="uncovered">
219
+ <td><pre><a name="line57">57</a> raw_command = []</pre></td>
220
+ </tr>
221
+ <tr class="uncovered">
222
+ <td><pre><a name="line58">58</a> @keep_connected = true</pre></td>
223
+ </tr>
224
+ <tr class="uncovered">
225
+ <td><pre><a name="line59">59</a> @first_connection = true</pre></td>
226
+ </tr>
227
+ <tr class="uncovered">
228
+ <td><pre><a name="line60">60</a> # Read command type</pre></td>
229
+ </tr>
230
+ <tr class="uncovered">
231
+ <td><pre><a name="line61">61</a> while @keep_connected &amp;&amp; raw_command = read_from_socket_with_timeout(socket, 9)</pre></td>
232
+ </tr>
233
+ <tr class="uncovered">
234
+ <td><pre><a name="line62">62</a> response = process_command(raw_command, socket)</pre></td>
235
+ </tr>
236
+ <tr class="uncovered">
237
+ <td><pre><a name="line63">63</a> socket.write response</pre></td>
238
+ </tr>
239
+ <tr class="uncovered">
240
+ <td><pre><a name="line64">64</a> @first_connection = false</pre></td>
241
+ </tr>
242
+ <tr class="uncovered">
243
+ <td><pre><a name="line65">65</a> end</pre></td>
244
+ </tr>
245
+ <tr class="uncovered">
246
+ <td><pre><a name="line66">66</a> ensure</pre></td>
247
+ </tr>
248
+ <tr class="uncovered">
249
+ <td><pre><a name="line67">67</a> socket.close unless socket.closed?</pre></td>
250
+ </tr>
251
+ <tr class="uncovered">
252
+ <td><pre><a name="line68">68</a> @threadsMutex.synchronize {</pre></td>
253
+ </tr>
254
+ <tr class="uncovered">
255
+ <td><pre><a name="line69">69</a> @threads.delete(Thread.current)</pre></td>
256
+ </tr>
257
+ <tr class="uncovered">
258
+ <td><pre><a name="line70">70</a> }</pre></td>
259
+ </tr>
260
+ <tr class="uncovered">
261
+ <td><pre><a name="line71">71</a> end</pre></td>
262
+ </tr>
263
+ <tr class="uncovered">
264
+ <td><pre><a name="line72">72</a> end</pre></td>
265
+ </tr>
266
+ <tr class="uncovered">
267
+ <td><pre><a name="line73">73</a> end</pre></td>
268
+ </tr>
269
+ <tr class="uncovered">
270
+ <td><pre><a name="line74">74</a> </pre></td>
271
+ </tr>
272
+ <tr class="uncovered">
273
+ <td><pre><a name="line75">75</a> def start</pre></td>
274
+ </tr>
275
+ <tr class="uncovered">
276
+ <td><pre><a name="line76">76</a> @server_thread = Thread.new do</pre></td>
277
+ </tr>
278
+ <tr class="uncovered">
279
+ <td><pre><a name="line77">77</a> Thread.current.abort_on_exception = true</pre></td>
280
+ </tr>
281
+ <tr class="uncovered">
282
+ <td><pre><a name="line78">78</a> @running = true</pre></td>
283
+ </tr>
284
+ <tr class="uncovered">
285
+ <td><pre><a name="line79">79</a> while @running</pre></td>
286
+ </tr>
287
+ <tr class="uncovered">
288
+ <td><pre><a name="line80">80</a> break if @server.closed?</pre></td>
289
+ </tr>
290
+ <tr class="uncovered">
291
+ <td><pre><a name="line81">81</a> socket = @server.accept</pre></td>
292
+ </tr>
293
+ <tr class="uncovered">
294
+ <td><pre><a name="line82">82</a> serve(socket)</pre></td>
295
+ </tr>
296
+ <tr class="uncovered">
297
+ <td><pre><a name="line83">83</a> end</pre></td>
298
+ </tr>
299
+ <tr class="uncovered">
300
+ <td><pre><a name="line84">84</a> end</pre></td>
301
+ </tr>
302
+ <tr class="uncovered">
303
+ <td><pre><a name="line85">85</a> self</pre></td>
304
+ </tr>
305
+ <tr class="uncovered">
306
+ <td><pre><a name="line86">86</a> end</pre></td>
307
+ </tr>
308
+ <tr class="uncovered">
309
+ <td><pre><a name="line87">87</a> </pre></td>
310
+ </tr>
311
+ <tr class="uncovered">
312
+ <td><pre><a name="line88">88</a> def stop</pre></td>
313
+ </tr>
314
+ <tr class="uncovered">
315
+ <td><pre><a name="line89">89</a> @threadsMutex.synchronize {</pre></td>
316
+ </tr>
317
+ <tr class="uncovered">
318
+ <td><pre><a name="line90">90</a> @threads.each{|thread| thread.kill}</pre></td>
319
+ </tr>
320
+ <tr class="uncovered">
321
+ <td><pre><a name="line91">91</a> @threads = []</pre></td>
322
+ </tr>
323
+ <tr class="uncovered">
324
+ <td><pre><a name="line92">92</a> }</pre></td>
325
+ </tr>
326
+ <tr class="uncovered">
327
+ <td><pre><a name="line93">93</a> @server_thread.kill if @server_thread</pre></td>
328
+ </tr>
329
+ <tr class="uncovered">
330
+ <td><pre><a name="line94">94</a> @server.close unless @server.closed?</pre></td>
331
+ </tr>
332
+ <tr class="uncovered">
333
+ <td><pre><a name="line95">95</a> @server_thread.join</pre></td>
334
+ </tr>
335
+ <tr class="uncovered">
336
+ <td><pre><a name="line96">96</a> @running = false</pre></td>
337
+ </tr>
338
+ <tr class="uncovered">
339
+ <td><pre><a name="line97">97</a> true</pre></td>
340
+ </tr>
341
+ <tr class="uncovered">
342
+ <td><pre><a name="line98">98</a> end</pre></td>
343
+ </tr>
344
+ <tr class="uncovered">
345
+ <td><pre><a name="line99">99</a> </pre></td>
346
+ </tr>
347
+ <tr class="uncovered">
348
+ <td><pre><a name="line100">100</a> def running?</pre></td>
349
+ </tr>
350
+ <tr class="uncovered">
351
+ <td><pre><a name="line101">101</a> @running</pre></td>
352
+ </tr>
353
+ <tr class="uncovered">
354
+ <td><pre><a name="line102">102</a> end</pre></td>
355
+ </tr>
356
+ <tr class="uncovered">
357
+ <td><pre><a name="line103">103</a> </pre></td>
358
+ </tr>
359
+ <tr class="uncovered">
360
+ <td><pre><a name="line104">104</a> private</pre></td>
361
+ </tr>
362
+ <tr class="uncovered">
363
+ <td><pre><a name="line105">105</a> def process_command(raw_command, socket)</pre></td>
364
+ </tr>
365
+ <tr class="uncovered">
366
+ <td><pre><a name="line106">106</a> case raw_command</pre></td>
367
+ </tr>
368
+ <tr class="uncovered">
369
+ <td><pre><a name="line107">107</a> when &quot;PGREP009b&quot; # Get time</pre></td>
370
+ </tr>
371
+ <tr class="uncovered">
372
+ <td><pre><a name="line108">108</a> response = &#39;REP008b&#39; + get_timeclock_time</pre></td>
373
+ </tr>
374
+ <tr class="uncovered">
375
+ <td><pre><a name="line109">109</a> when &quot;PGREP016A&quot; # Set time</pre></td>
376
+ </tr>
377
+ <tr class="uncovered">
378
+ <td><pre><a name="line110">110</a> payload = read_from_socket_with_timeout(socket, 7)</pre></td>
379
+ </tr>
380
+ <tr class="uncovered">
381
+ <td><pre><a name="line111">111</a> response = &#39;REP008A&#39; + payload</pre></td>
382
+ </tr>
383
+ <tr class="uncovered">
384
+ <td><pre><a name="line112">112</a> set_timeclock_time(payload)</pre></td>
385
+ </tr>
386
+ <tr class="uncovered">
387
+ <td><pre><a name="line113">113</a> when &quot;PGREP009Z&quot;</pre></td>
388
+ </tr>
389
+ <tr class="uncovered">
390
+ <td><pre><a name="line114">114</a> response = &#39;REP2359&#39; + @data.afd.header.export + &quot;\r\n&quot;</pre></td>
391
+ </tr>
392
+ <tr class="uncovered">
393
+ <td><pre><a name="line115">115</a> @keep_connected = false</pre></td>
394
+ </tr>
395
+ <tr class="uncovered">
396
+ <td><pre><a name="line116">116</a> when &quot;PGREP0289&quot;</pre></td>
397
+ </tr>
398
+ <tr class="uncovered">
399
+ <td><pre><a name="line117">117</a> @afd_read_start_id = read_from_socket_with_timeout(socket, 9).to_i</pre></td>
400
+ </tr>
401
+ <tr class="uncovered">
402
+ <td><pre><a name="line118">118</a> @afd_read_end_id = read_from_socket_with_timeout(socket, 9).to_i</pre></td>
403
+ </tr>
404
+ <tr class="uncovered">
405
+ <td><pre><a name="line119">119</a> @afd_read_current_id = nil</pre></td>
406
+ </tr>
407
+ <tr class="uncovered">
408
+ <td><pre><a name="line120">120</a> @afd_read_finished = false</pre></td>
409
+ </tr>
410
+ <tr class="uncovered">
411
+ <td><pre><a name="line121">121</a> response = &quot;REP0029[&quot;</pre></td>
412
+ </tr>
413
+ <tr class="uncovered">
414
+ <td><pre><a name="line122">122</a> when &quot;PGREP009,&quot;</pre></td>
415
+ </tr>
416
+ <tr class="uncovered">
417
+ <td><pre><a name="line123">123</a> if @afd_read_finished</pre></td>
418
+ </tr>
419
+ <tr class="uncovered">
420
+ <td><pre><a name="line124">124</a> response = &quot;REP0029]&quot;</pre></td>
421
+ </tr>
422
+ <tr class="uncovered">
423
+ <td><pre><a name="line125">125</a> @keep_connected = false</pre></td>
424
+ </tr>
425
+ <tr class="uncovered">
426
+ <td><pre><a name="line126">126</a> else</pre></td>
427
+ </tr>
428
+ <tr class="uncovered">
429
+ <td><pre><a name="line127">127</a> if @afd_read_current_id.nil?</pre></td>
430
+ </tr>
431
+ <tr class="uncovered">
432
+ <td><pre><a name="line128">128</a> @afd_read_current_id = @afd_read_start_id</pre></td>
433
+ </tr>
434
+ <tr class="uncovered">
435
+ <td><pre><a name="line129">129</a> response = &#39;REP3029&#39;</pre></td>
436
+ </tr>
437
+ <tr class="uncovered">
438
+ <td><pre><a name="line130">130</a> elsif @afd_read_current_id == @afd_read_end_id or @afd_read_current_id &gt;= @data.afd.records.size</pre></td>
439
+ </tr>
440
+ <tr class="uncovered">
441
+ <td><pre><a name="line131">131</a> response = &#39;REP0909&#39;</pre></td>
442
+ </tr>
443
+ <tr class="uncovered">
444
+ <td><pre><a name="line132">132</a> @afd_read_finished = true</pre></td>
445
+ </tr>
446
+ <tr class="uncovered">
447
+ <td><pre><a name="line133">133</a> else</pre></td>
448
+ </tr>
449
+ <tr class="uncovered">
450
+ <td><pre><a name="line134">134</a> response = &#39;REP0379&#39;</pre></td>
451
+ </tr>
452
+ <tr class="uncovered">
453
+ <td><pre><a name="line135">135</a> end</pre></td>
454
+ </tr>
455
+ <tr class="uncovered">
456
+ <td><pre><a name="line136">136</a> afd_records = ([@data.afd.header] + @data.afd.records)</pre></td>
457
+ </tr>
458
+ <tr class="uncovered">
459
+ <td><pre><a name="line137">137</a> response += afd_records[@afd_read_current_id].export + &quot;\r\n&quot;</pre></td>
460
+ </tr>
461
+ <tr class="uncovered">
462
+ <td><pre><a name="line138">138</a> end</pre></td>
463
+ </tr>
464
+ <tr class="uncovered">
465
+ <td><pre><a name="line139">139</a> @afd_read_current_id += 1</pre></td>
466
+ </tr>
467
+ <tr class="uncovered">
468
+ <td><pre><a name="line140">140</a> when &quot;PGREP075h&quot;</pre></td>
469
+ </tr>
470
+ <tr class="uncovered">
471
+ <td><pre><a name="line141">141</a> payload = read_from_socket_with_timeout(socket, 66)</pre></td>
472
+ </tr>
473
+ <tr class="uncovered">
474
+ <td><pre><a name="line142">142</a> raw_registration, raw_pis, raw_name = payload.scan(/.(.{6})(.{6})(.+)/).flatten</pre></td>
475
+ </tr>
476
+ <tr class="uncovered">
477
+ <td><pre><a name="line143">143</a> registration = convert_bytes_to_string(raw_registration)</pre></td>
478
+ </tr>
479
+ <tr class="uncovered">
480
+ <td><pre><a name="line144">144</a> pis = convert_bytes_to_string(raw_pis)</pre></td>
481
+ </tr>
482
+ <tr class="uncovered">
483
+ <td><pre><a name="line145">145</a> name = raw_name.strip</pre></td>
484
+ </tr>
485
+ <tr class="uncovered">
486
+ <td><pre><a name="line146">146</a> @data.employees &lt;&lt; {name: name, pis: pis, registration: registration}</pre></td>
487
+ </tr>
488
+ <tr class="uncovered">
489
+ <td><pre><a name="line147">147</a> response = &quot;REP003h1\0&quot;</pre></td>
490
+ </tr>
491
+ <tr class="uncovered">
492
+ <td><pre><a name="line148">148</a> when &quot;PGREP016j&quot;</pre></td>
493
+ </tr>
494
+ <tr class="uncovered">
495
+ <td><pre><a name="line149">149</a> payload = read_from_socket_with_timeout(socket, 7)</pre></td>
496
+ </tr>
497
+ <tr class="uncovered">
498
+ <td><pre><a name="line150">150</a> raw_registration = payload.scan(/.(.{6})/).flatten[0]</pre></td>
499
+ </tr>
500
+ <tr class="uncovered">
501
+ <td><pre><a name="line151">151</a> registration = convert_bytes_to_string(raw_registration)</pre></td>
502
+ </tr>
503
+ <tr class="uncovered">
504
+ <td><pre><a name="line152">152</a> @data.employees.delete_if{|employee| employee[:registration] == registration}</pre></td>
505
+ </tr>
506
+ <tr class="uncovered">
507
+ <td><pre><a name="line153">153</a> response = &quot;REP003j1\0&quot;</pre></td>
508
+ </tr>
509
+ <tr class="uncovered">
510
+ <td><pre><a name="line154">154</a> when &#39;PGREP010h&#39;, &#39;PGREP010j&#39;</pre></td>
511
+ </tr>
512
+ <tr class="uncovered">
513
+ <td><pre><a name="line155">155</a> # Don&#39;t care for the result of these comands, just disconnect when</pre></td>
514
+ </tr>
515
+ <tr class="uncovered">
516
+ <td><pre><a name="line156">156</a> # possible.</pre></td>
517
+ </tr>
518
+ <tr class="uncovered">
519
+ <td><pre><a name="line157">157</a> @keep_connected = false</pre></td>
520
+ </tr>
521
+ <tr class="uncovered">
522
+ <td><pre><a name="line158">158</a> response = &quot;&quot;</pre></td>
523
+ </tr>
524
+ <tr class="uncovered">
525
+ <td><pre><a name="line159">159</a> else</pre></td>
526
+ </tr>
527
+ <tr class="uncovered">
528
+ <td><pre><a name="line160">160</a> raise StandardError.new(&quot;Unknown command \&quot;#{raw_command}\&quot;!&quot;)</pre></td>
529
+ </tr>
530
+ <tr class="uncovered">
531
+ <td><pre><a name="line161">161</a> end</pre></td>
532
+ </tr>
533
+ <tr class="uncovered">
534
+ <td><pre><a name="line162">162</a> response</pre></td>
535
+ </tr>
536
+ <tr class="uncovered">
537
+ <td><pre><a name="line163">163</a> end</pre></td>
538
+ </tr>
539
+ <tr class="uncovered">
540
+ <td><pre><a name="line164">164</a> </pre></td>
541
+ </tr>
542
+ <tr class="uncovered">
543
+ <td><pre><a name="line165">165</a> def read_from_socket_with_timeout(socket, bytes_to_be_read, timeout_value=5)</pre></td>
544
+ </tr>
545
+ <tr class="uncovered">
546
+ <td><pre><a name="line166">166</a> data_to_receive = nil</pre></td>
547
+ </tr>
548
+ <tr class="uncovered">
549
+ <td><pre><a name="line167">167</a> timeout_value = 600 if @first_connection # use a large timeout on first connection</pre></td>
550
+ </tr>
551
+ <tr class="uncovered">
552
+ <td><pre><a name="line168">168</a> timeout(timeout_value) { data_to_receive = socket.readpartial( bytes_to_be_read ) }</pre></td>
553
+ </tr>
554
+ <tr class="uncovered">
555
+ <td><pre><a name="line169">169</a> return data_to_receive</pre></td>
556
+ </tr>
557
+ <tr class="uncovered">
558
+ <td><pre><a name="line170">170</a> end</pre></td>
559
+ </tr>
560
+ <tr class="uncovered">
561
+ <td><pre><a name="line171">171</a> </pre></td>
562
+ </tr>
563
+ <tr class="uncovered">
564
+ <td><pre><a name="line172">172</a> def get_timeclock_time(current_time=nil)</pre></td>
565
+ </tr>
566
+ <tr class="uncovered">
567
+ <td><pre><a name="line173">173</a> current_time ||= @data.time</pre></td>
568
+ </tr>
569
+ <tr class="uncovered">
570
+ <td><pre><a name="line174">174</a> CodinRep::TimeUtil.pack current_time</pre></td>
571
+ </tr>
572
+ <tr class="uncovered">
573
+ <td><pre><a name="line175">175</a> end</pre></td>
574
+ </tr>
575
+ <tr class="uncovered">
576
+ <td><pre><a name="line176">176</a> </pre></td>
577
+ </tr>
578
+ <tr class="uncovered">
579
+ <td><pre><a name="line177">177</a> def set_timeclock_time(payload)</pre></td>
580
+ </tr>
581
+ <tr class="uncovered">
582
+ <td><pre><a name="line178">178</a> time = CodinRep::TimeUtil.unpack payload</pre></td>
583
+ </tr>
584
+ <tr class="uncovered">
585
+ <td><pre><a name="line179">179</a> @data.time = time</pre></td>
586
+ </tr>
587
+ <tr class="uncovered">
588
+ <td><pre><a name="line180">180</a> return time</pre></td>
589
+ </tr>
590
+ <tr class="uncovered">
591
+ <td><pre><a name="line181">181</a> end</pre></td>
592
+ </tr>
593
+ <tr class="uncovered">
594
+ <td><pre><a name="line182">182</a> </pre></td>
595
+ </tr>
596
+ <tr class="uncovered">
597
+ <td><pre><a name="line183">183</a> def convert_bytes_to_string(bytes)</pre></td>
598
+ </tr>
599
+ <tr class="uncovered">
600
+ <td><pre><a name="line184">184</a> bytes.unpack(&#39;H*&#39;)[0]</pre></td>
601
+ </tr>
602
+ <tr class="uncovered">
603
+ <td><pre><a name="line185">185</a> end</pre></td>
604
+ </tr>
605
+ <tr class="uncovered">
606
+ <td><pre><a name="line186">186</a> end</pre></td>
607
+ </tr>
608
+ <tr class="uncovered">
609
+ <td><pre><a name="line187">187</a> end</pre></td>
610
+ </tr>
611
+ </tbody>
612
+ </table>
613
+
614
+ <p>Generated on 2017-01-25 17:10:31 -0200 with <a href="https://github.com/fguillen/simplecov-rcov">SimpleCov-RCov 0.2.3</a></p>
615
+
616
+ </body>
617
+ </html>