Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/codin_rep/get_time.rb | 57 | 57 | 0.00%
|
0.00%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
2 # -*- coding: utf-8 -*- |
3 # codin_rep - Gem para acesso de REPs da Telebyte |
4 # Copyright (C) 2016 O.S. Systems Softwares Ltda. |
5 |
6 # This program is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU Affero General Public License as |
8 # published by the Free Software Foundation, either version 3 of the |
9 # License, or (at your option) any later version. |
10 |
11 # This program is distributed in the hope that it will be useful, |
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 # GNU Affero General Public License for more details. |
15 |
16 # You should have received a copy of the GNU Affero General Public License |
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 |
19 # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil. |
20 # e-mail: contato@ossystems.com.br |
21 |
22 require "codin_rep/command" |
23 require 'codin_rep/time_util' |
24 |
25 module CodinRep |
26 class GetTime < Command |
27 COMMAND_CODE = "009b".freeze |
28 EXPECTED_HEADER = 'REP008b'.freeze |
29 |
30 def generate_command_payload |
31 "" |
32 end |
33 |
34 def get_expected_response_size |
35 14 |
36 end |
37 |
38 def check_response_header |
39 unless @response.match(/^#{EXPECTED_HEADER}/) |
40 raise UnknownHeader.new @response[0..6], 'get time', EXPECTED_HEADER |
41 end |
42 end |
43 |
44 def get_response_payload |
45 @response_payload = @response[7..-1] |
46 end |
47 |
48 def get_data_from_response_payload |
49 @time = nil |
50 begin |
51 @time = CodinRep::TimeUtil.unpack @response_payload |
52 rescue ArgumentError |
53 raise MalformedResponsePayload.new 'get time' |
54 end |
55 return [@time, Date.civil(1970,1,1), Date.civil(1970,1,1)] |
56 end |
57 end |
58 end |
Generated on 2017-02-21 09:19:39 -0300 with SimpleCov-RCov 0.2.3