automotive-ecu 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3139f297c357d29c6be36cc632e0cbebf76a3c76e736643c167f5cfe7dc76bf
4
- data.tar.gz: 3323e14ffcd10a81a12ef769b082cf9f7564b1270531577668e1c7245d8c15c3
3
+ metadata.gz: 24338ba9633d36789c4ba4f5c7ae67659c2dca146a878ae426555afcc18419cc
4
+ data.tar.gz: 70103adf18b506ab21d62bd5d8c9a95266d19dac8a7d2688c55ed85748fa6d10
5
5
  SHA512:
6
- metadata.gz: fa1e976d1554572d6d5cf99c3dad4b962f6e6a25fc125186cebf0fd0c9bafe090cd5ca160dc54871a472ec5ddb1a7136f0fd8d28b11e5678abd71c8e8a301e46
7
- data.tar.gz: 020715725ac80d08fe8171d1af0f93b80dec3541fcd96272c1a77400f8de88fcae6ad54233c44e00214cfc7bbd96137d8ad0cccf27d3c756516f053f5f525486
6
+ metadata.gz: 1c4624a8d94693d35d9db642d677816b26bb461e7676837147ae4c81fb013f2097d884e90b00dcb92f0781ee335c939360ec20ab40712c5ff223921c030da169
7
+ data.tar.gz: 5f92059a106311e053750e57f36b5341850b4dfab169ec1edcb7a263d1078191c339a9b4b221b668539a2ded36dc356f2b8a5fc55968cd1743a74aad86bb8003
@@ -62,7 +62,7 @@ class Ecu
62
62
  else
63
63
  buffer.append!(line)
64
64
  end
65
- rescue RuntimeError => e
65
+ rescue StandardError => e
66
66
  raise MalformedDcmError.new(e.message, n, str), e.message
67
67
  end
68
68
 
@@ -31,7 +31,7 @@ class Ecu
31
31
  end
32
32
 
33
33
  def self.numeric_array(str)
34
- str.split.map { Float(_1) rescue Label::InvalidValue.new(_1) }
34
+ str.split.map { Float(_1) }
35
35
  end
36
36
 
37
37
  def self.string_array(str)
@@ -39,13 +39,4 @@ class Ecu
39
39
  end
40
40
 
41
41
  end
42
-
43
- class Label
44
- InvalidValue = Struct.new(:value) do
45
- def to_s
46
- "<InvalidValue: \"#{value}\">"
47
- end
48
- def inspect; to_s; end
49
- end
50
- end
51
42
  end
@@ -22,6 +22,7 @@ class Ecu
22
22
  case File.extname(file_path)
23
23
  when ".lab" then self.from_lab(File.read_encoded(file_path))
24
24
  when ".a2l" then self.from_a2l(File.read_encoded(file_path))
25
+ when ".dcm" then self.from_dcm(File.read_encoded(file_path))
25
26
  else fail "Unknown file extension: #{file_path}!"
26
27
  end
27
28
  end
@@ -9,17 +9,10 @@ class Ecu
9
9
  def eql?
10
10
  return false unless @left.class == @right.class
11
11
  case @left
12
- when String then
13
- @left == @right
14
- when Numeric then
15
- @left == @right
16
- when Array then
17
- return false unless @left.size == @right.size
18
- @left.zip(@right).all? do |a, b|
19
- self.class.new(a, b).eql?
20
- end
21
- when NilClass then
22
- @left == @right
12
+ when NilClass then @left == @right
13
+ when String then @left == @right
14
+ when Numeric then @left == @right
15
+ when Array then arrays_eql?(@left, @right)
23
16
  else
24
17
  fail "Unkown value class: #{@left.class}"
25
18
  end
@@ -27,6 +20,12 @@ class Ecu
27
20
 
28
21
  private
29
22
 
23
+ def arrays_eql?(left, right)
24
+ return false unless left.size == right.size
25
+
26
+ left.zip(right).all? { self.class.new(*_1).eql? }
27
+ end
28
+
30
29
  def check_compatibility(left, right)
31
30
  if left.class != right.class
32
31
  fail ArgumentError, "Values must have the same class for comparison (#{left}: #{left.class}/#{right}: #{right.class})"
data/lib/ecu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Ecu
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automotive-ecu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Mueller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-18 00:00:00.000000000 Z
11
+ date: 2024-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: terminal-table
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.4.19
157
+ rubygems_version: 3.5.11
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: A simple API for managing automotive ecu signals and labels