datanorm 1.0.5 → 1.0.7

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: 1cb4e19feeb3ab8d42bfa277034d2a37461fbbc9bb22fc52ef3e1908b0e95027
4
- data.tar.gz: fc6dff713d8ae6f3c38ee09bf94e74c3be4b8594c820b49284c39d648ab81ce8
3
+ metadata.gz: 065ea784071baba768257ab08781410cf92791d66c67671868a461266bc97982
4
+ data.tar.gz: cac6e4d71a506b11c57dc6495b8c7bf03fa626d528915dac0f53bbbd9f03185a
5
5
  SHA512:
6
- metadata.gz: 2206253b424b6e4ad0d40ecb694efb0d408c9f662d3dcc94d5a0c3ade74f082a2f67c8cca5298bcdabdf7a542db38e9462eea138d5ea4bb018ce1109856842a0
7
- data.tar.gz: 7b5d79b76592eff0eba60ac72d715989e65b36c2eaadc41154976ef39e93e76690d269ee287762f87900af34ef3d63531d4082fb6ee679d9e413882a8c611e47
6
+ metadata.gz: 1a192ff308125a6259f38d1b649dc0166546b2da4ab028e4a12055051ae94ae085b446f412962bd366e7b42a75b248c66573973146a0171dba32c15851e990cf
7
+ data.tar.gz: 98075448fb648b86977353d9595f1ae6dcc3cfaa2aefd5719ac5a0daab90f6af17e0f129afe7bd582b84e70e8b27f56e74801ad4b8ec575453ab840753d8f970
@@ -13,7 +13,7 @@ module Datanorm
13
13
  def call
14
14
  return unless products_file.file?
15
15
 
16
- ::File.foreach(products_file) do |json|
16
+ ::File.foreach(products_file, encoding: Encoding::UTF_8) do |json|
17
17
  progress.increment!
18
18
 
19
19
  if yield_progress
@@ -34,7 +34,7 @@ module Datanorm
34
34
  return @products_count if defined?(@products_count)
35
35
 
36
36
  @products_count = 0
37
- ::File.foreach(products_file) { @products_count += 1 }
37
+ ::File.foreach(products_file, encoding: Encoding::UTF_8) { @products_count += 1 }
38
38
  @products_count
39
39
  end
40
40
 
@@ -153,7 +153,7 @@ module Datanorm
153
153
 
154
154
  @dimension_content = begin
155
155
  path = workdir.join('D', ::Datanorm::Helpers::Filename.call(id))
156
- path.read if path.file?
156
+ path.read(encoding: Encoding::UTF_8) if path.file?
157
157
  end
158
158
  end
159
159
 
@@ -31,14 +31,14 @@ module Datanorm
31
31
 
32
32
  def read_file!
33
33
  if split_newlines
34
- path.read.split("\n")
34
+ path.read(encoding: Encoding::UTF_8).split("\n")
35
35
  else
36
- path.read
36
+ path.read(encoding: Encoding::UTF_8)
37
37
  end
38
38
  end
39
39
 
40
40
  def read_json!
41
- JSON.parse(path.read, symbolize_names: true)
41
+ JSON.parse(path.read(encoding: Encoding::UTF_8), symbolize_names: true)
42
42
  end
43
43
  end
44
44
  end
@@ -31,7 +31,7 @@ module Datanorm
31
31
 
32
32
  def do_read_currently_cached_lines
33
33
  if filepath.exist?
34
- @lines = filepath.readlines(chomp: true)
34
+ @lines = filepath.readlines(chomp: true, encoding: Encoding::UTF_8)
35
35
  Tron.success(:loaded_current_file_content)
36
36
  else
37
37
  @lines = []
@@ -4,17 +4,33 @@ module Datanorm
4
4
  module Lines
5
5
  module V5
6
6
  # Immediate product description texts. Should take precedence over Text records.
7
+ # Aufbau der „D" Zeile (Dimensionstextsatz)
8
+ # 1 : Satzartenkennzeichen[1] : Buchstabe D für Dimensionstext
9
+ # 2 : Verarbeitungskennzeichen[1] : N=Neuanlage, L=Löschung, A=Änderung
10
+ # 3 : Artikelnummer[15] : Inhalt alphanumerische Zeichen
11
+ # 4 : Zeilennummer[2/0] : numerisch
12
+ # 5 : Unterkennzeichen[1] : alphanumerisch, F = freier Text, T = Einfügen von Textblöcken
13
+ # 6 : Frei[8] : alphanumerische Zeichen
14
+ # 7 : Zeilentext[40] : alphanumerische Zeichen
7
15
  class Dimension < ::Datanorm::Lines::Base
8
16
  def to_s
9
- "[#{id}] DIMENSION-5 - #{columns}"
17
+ "<Dimension [#{id}] #{line_number.to_s.rjust(3)} #{content.gsub("\n", '⏎')}>"
10
18
  end
11
19
 
12
20
  def id
13
21
  encode columns[2]
14
22
  end
15
23
 
24
+ def line_number
25
+ columns[3].to_i
26
+ end
27
+
16
28
  def content
17
- to_s
29
+ encode columns[6]
30
+ end
31
+
32
+ def <=>(other)
33
+ line_number <=> other.line_number
18
34
  end
19
35
  end
20
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datanorm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubygems_version: 3.7.1
159
+ rubygems_version: 4.0.6
160
160
  specification_version: 4
161
161
  summary: Parse German DATANORM files like you belong to the 90s
162
162
  test_files: []