automotive-ecu 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaf31b67eb5936b0a5f3e1312335b0407c04701103e4da639a596115c10c2fb8
4
- data.tar.gz: 56f7829412d3fb9755ecd9b7cf21eb4846287740b1b7382f46109d37959781f8
3
+ metadata.gz: ab586bfaab8ab1d647a8f0f76cd247798baba7e10e207a9e03173a854fb13817
4
+ data.tar.gz: 39cf49dca991aa8966dd679914d9d88f05585e7b0a34fdff29a8783e2eae19d9
5
5
  SHA512:
6
- metadata.gz: c71b48f6c2ac067fc0ad207e74aee69ab1eb6a45bac26a67026a47b86a4d92b21469aafafaf9a520429791d433a471329e1a57698413def5762a5291776625da
7
- data.tar.gz: 65be4dbe384d9c806bebf9fc9fc870893923b53806e91244355bff64996637c56855829338ea115f6c71c08e29882e3b76a349aa693b958cb38104c06c71ee03
6
+ metadata.gz: 21a979a28ff42b637574725b54a0dc46ff5a4659f0a26bdb50ec0e6a81c0262a46d14891af2f09f8846a545f1decb6e2994c4de92dbf05b8f0171c6f946b27f5
7
+ data.tar.gz: 2f2026c2d122d4ecd2295ff941c4fb397fe5b20383ab927e731a80178733d69e86a23343429abf751c8beab39b8483bd8c35ce62049a3af0302436668a986d6d
@@ -24,7 +24,7 @@ class Ecu
24
24
 
25
25
  HEADER = "KONSERVIERUNG_FORMAT 2.0"
26
26
  WHITESPACE = %r{ [ \t]+ }x
27
- NEWLINE = %r{ \r\n|\n }x
27
+ NEWLINE = %r{ \r\n|\n|\r }x
28
28
  COMMENT = %r{ ^\*.*$ }x
29
29
  DIMENSIONS_SEP = %r{ @ }x
30
30
  QUOTED_TEXT = %r{ "[^"]*" }x
@@ -12,13 +12,14 @@ class Ecu
12
12
 
13
13
  def message = @msg
14
14
  def context
15
- @doc
16
- .lines[ctx_startline..ctx_endline]
15
+ lines[ctx_startline..ctx_endline]
17
16
  .each
18
17
  .with_index(ctx_startline + 1)
19
18
  .map { |line, n| present(line, n, n == lineno) }
20
19
  end
21
20
 
21
+ def lines = @lines ||= doc.lines
22
+
22
23
  def present(line, n, highlight)
23
24
  case highlight
24
25
  when true then fmt(n) + " => | " + line
@@ -27,7 +28,7 @@ class Ecu
27
28
  end
28
29
 
29
30
  def ctx_startline = [0, lineno - CTXLENGHT].max
30
- def ctx_endline = @endline ||= [doc.lines.count - 1, lineno + CTXLENGHT].min
31
+ def ctx_endline = @endline ||= [lines.size - 1, lineno + CTXLENGHT].min
31
32
  def fmt_str = "%#{(ctx_endline + 1).to_s.length}d"
32
33
  def fmt(n) = fmt_str % n
33
34
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Ecu
2
4
  class Festwert < Label
3
5
  def to_dcm(indented=false)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../../../core_ext"
2
4
 
3
5
  class Ecu
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Ecu
2
4
  class Kennfeld < Label
3
5
  def to_dcm(indented=false)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Ecu
2
4
  class Kennlinie < Label
3
5
  def to_dcm(indented=false)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Ecu
2
4
  class Label
3
5
  def to_dcm
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "festwert"
2
4
  require_relative "festwerteblock"
3
5
  require_relative "kennlinie"
@@ -29,7 +31,7 @@ class Ecu
29
31
  end
30
32
 
31
33
  def to_dcm(indented=false)
32
- buf = String.new
34
+ buf = +""
33
35
 
34
36
  unless headers.empty?
35
37
  headers.each { buf << "* " << _1 << "\n" }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Ecu
2
4
  class Stuetzstellenverteilung < Label
3
5
  def to_dcm(indented=false)
data/lib/ecu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Ecu
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automotive-ecu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Mueller