cbor-diag 0.9.6 → 0.9.8

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: 631c389a533d3e6f72e51edc36b3b4c9445da85a8f0b2db434f2285be4b1183c
4
- data.tar.gz: 51f112b3b0c7f768ab1cfacdaef33409029a60a8519503dea5786a4f682b8137
3
+ metadata.gz: ae0f990a039f1c2b0c08af5ff06a25868210f0aaf219810674e254fb3e1dabe9
4
+ data.tar.gz: 812d69e74907bb80861a277c60f58a17522fa14869eeddc8b2ecfcd78533cb12
5
5
  SHA512:
6
- metadata.gz: d4a8d6038180fd7172ede1976e92963fe3350e5b8dfbf285ba310a4b9671e9b60cc0851851a197d3d8202d450ef9ab24c1190cc11c8ab38e3d366ca3599f1937
7
- data.tar.gz: 7af789dc8dcba93c6a204d829b8727a3840b83a3a5d0f5cdf705f58996db4eccb1897f6b0bf54eaa9db3df38048f79d4331cb4ebacaf48d8b7bb0a8aeb9c9c55
6
+ metadata.gz: 40d28a0d95ffdfcf1badd9dda4d1200385306fe5ceb53492ec6ed246ffe08b763583a0c364d33714c174ffcea4002e57ff46448a0d82a52de5fc7c1247b72a60
7
+ data.tar.gz: 42c5aaa0fcb2600d6ef515db1d8e9739ba769c2d4ba65e8b4d9948932b08e532f20edee1ed7f7ecbf883186b6f744a404d519fc1f5cb9d03f447fc73172146e8
data/bin/cbor2cbor.rb ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ require 'cbor-diagnostic'
3
+ require 'cbor-packed'
4
+ require 'cbor-deterministic'
5
+ require 'cbor-canonical'
6
+
7
+
8
+ require 'cbor-diagnostic-helper'
9
+ options = cbor_diagnostic_process_args("cdpq")
10
+
11
+ $stdout.binmode
12
+ ARGF.binmode
13
+ i = ARGF.read
14
+ o = CBOR.decode(i)
15
+ print(CBOR::encode(cbor_diagnostic_item_processing(o, options)))
16
+
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ require 'cbor-diagnostic'
3
+ require 'cbor-packed'
4
+ require 'cbor-deterministic'
5
+ require 'cbor-canonical'
6
+
7
+
8
+ require 'cbor-diagnostic-helper'
9
+ options = cbor_diagnostic_process_args("cdpq")
10
+
11
+ $stdout.binmode
12
+ ARGF.binmode
13
+ i = ARGF.read
14
+ totalsize = i.bytesize
15
+ while !i.empty?
16
+ begin
17
+ o, i = CBOR.decode_with_rest(i)
18
+ rescue StandardError => e
19
+ puts "/ *** Garbage at byte #{totalsize-i.bytesize}: #{e.message} /"
20
+ exit 1
21
+ end
22
+ print(CBOR::encode(cbor_diagnostic_item_processing(o, options)))
23
+ end
data/cbor-diag.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cbor-diag"
3
- s.version = "0.9.6"
3
+ s.version = "0.9.8"
4
4
  s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
5
5
  s.description = %q{cbor-diag implements diagnostic notation for CBOR, RFC 8949 and RFC 8742}
6
6
  s.author = "Carsten Bormann"
@@ -0,0 +1,7 @@
1
+ class CBOR_DIAG::AppParseError < ArgumentError
2
+ attr_accessor :position
3
+ def initialize(msg, pos)
4
+ @position = pos
5
+ super(msg)
6
+ end
7
+ end
@@ -67,7 +67,20 @@ class String
67
67
  end
68
68
  end
69
69
  if options[:bytes_as_text] && (u8 = dup.force_encoding(Encoding::UTF_8)).valid_encoding?
70
- "'#{u8.cbor_diagnostic(options)[1..-2].gsub("'", "\\\\'")}'" # \' is a backref, so needs \\'
70
+ "'#{u8.cbor_diagnostic(bytes_as_text: true,
71
+ utf8: options[:utf8]
72
+ )[1..-2].gsub(/(')|(\\")|(\\.)|([^\\']+)/) {
73
+ if $1
74
+ "\\'"
75
+ elsif $2
76
+ "\""
77
+ elsif $3
78
+ $3
79
+ elsif $4
80
+ $4
81
+ else
82
+ fail
83
+ end}}'"
71
84
  else
72
85
  "h'#{hexbytes}'"
73
86
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbor-diag
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-17 00:00:00.000000000 Z
10
+ date: 2025-07-03 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler
@@ -110,12 +110,14 @@ dependencies:
110
110
  description: cbor-diag implements diagnostic notation for CBOR, RFC 8949 and RFC 8742
111
111
  email: cabo@tzi.org
112
112
  executables:
113
+ - cbor2cbor.rb
113
114
  - cbor2diag.rb
114
115
  - cbor2json.rb
115
116
  - cbor2pretty.rb
116
117
  - cbor2u8.rb
117
118
  - cbor2yaml.rb
118
119
  - cborleader2diag.rb
120
+ - cborseq2cborseq.rb
119
121
  - cborseq2diag.rb
120
122
  - cborseq2json.rb
121
123
  - cborseq2neatjson.rb
@@ -136,12 +138,14 @@ executables:
136
138
  extensions: []
137
139
  extra_rdoc_files: []
138
140
  files:
141
+ - bin/cbor2cbor.rb
139
142
  - bin/cbor2diag.rb
140
143
  - bin/cbor2json.rb
141
144
  - bin/cbor2pretty.rb
142
145
  - bin/cbor2u8.rb
143
146
  - bin/cbor2yaml.rb
144
147
  - bin/cborleader2diag.rb
148
+ - bin/cborseq2cborseq.rb
145
149
  - bin/cborseq2diag.rb
146
150
  - bin/cborseq2json.rb
147
151
  - bin/cborseq2neatjson.rb
@@ -161,6 +165,7 @@ files:
161
165
  - bin/yaml2json.rb
162
166
  - cbor-diag.gemspec
163
167
  - lib/cbor-diag-parser.rb
168
+ - lib/cbor-diagnostic-app/0.rb
164
169
  - lib/cbor-diagnostic-app/dt.rb
165
170
  - lib/cbor-diagnostic-app/hash.rb
166
171
  - lib/cbor-diagnostic-app/nan.rb