cbor-diag 0.11.2 → 0.11.3
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 +4 -4
- data/cbor-diag.gemspec +1 -1
- data/lib/cbor-diagnostic-app/bytes.rb +15 -0
- data/lib/cbor-diagnostic-app/same.rb +22 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0c0c35275d12c07b1b3acc44965f9ff474d8115967b75978b0b15e76c6fce09b
|
|
4
|
+
data.tar.gz: d78c3ef942141c80f5b8db750da00e403b4d9ffe3b0f906ad31b897af4a13885
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9069cbe7956a8bcd38e5855d067018ce546b25c602b2a8451572b9163188e1e9b23b82fed741e0a98058815ce3af80d727556fc4e9bd4eb82d8d186a7faa4b1
|
|
7
|
+
data.tar.gz: b5f4725bc4109487b6e7d2a412b5a9ddd494477e9f653741ba89363980599819675c60543d9d147ffb5252f4c48364a57f76261aa2a3718b167367318ac6f538
|
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.11.
|
|
3
|
+
s.version = "0.11.3"
|
|
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,15 @@
|
|
|
1
|
+
require 'cbor-deterministic'
|
|
2
|
+
|
|
3
|
+
class CBOR_DIAG::App_bytes
|
|
4
|
+
def self.decode(_, s)
|
|
5
|
+
if CBOR::Sequence === s
|
|
6
|
+
a = s.elements
|
|
7
|
+
else
|
|
8
|
+
a = [s]
|
|
9
|
+
end
|
|
10
|
+
if a.detect { |el| not String === el }
|
|
11
|
+
raise ArgumentError.new("cbor-diagnostic: bytes<<#{a.cbor_diagnostic[1...-1]}>>: not all strings: Argument Error")
|
|
12
|
+
end
|
|
13
|
+
a.join.b
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'cbor-deterministic'
|
|
2
|
+
|
|
3
|
+
class CBOR_DIAG::App_same
|
|
4
|
+
def self.decode(_, s)
|
|
5
|
+
if CBOR::Sequence === s
|
|
6
|
+
a = s.elements
|
|
7
|
+
else
|
|
8
|
+
a = [s]
|
|
9
|
+
end
|
|
10
|
+
unless a.size > 0
|
|
11
|
+
raise ArgumentError.new("cbor-diagnostic: same<< #{a.inspect[1...-1]} >>: Argument Error")
|
|
12
|
+
end
|
|
13
|
+
v1 = a.first
|
|
14
|
+
e1 = v1.to_deterministic_cbor
|
|
15
|
+
a[1..-1].each do |v2|
|
|
16
|
+
unless v2.to_deterministic_cbor == e1
|
|
17
|
+
raise ArgumentError.new("cbor-diagnostic: same<<>>: #{v1.cbor_diagnostic} not same as #{v2.cbor_diagnostic}: Argument Error")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
v1
|
|
21
|
+
end
|
|
22
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cbor-diag
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carsten Bormann
|
|
@@ -166,10 +166,12 @@ files:
|
|
|
166
166
|
- cbor-diag.gemspec
|
|
167
167
|
- lib/cbor-diag-parser.rb
|
|
168
168
|
- lib/cbor-diagnostic-app/0.rb
|
|
169
|
+
- lib/cbor-diagnostic-app/bytes.rb
|
|
169
170
|
- lib/cbor-diagnostic-app/dt.rb
|
|
170
171
|
- lib/cbor-diagnostic-app/float.rb
|
|
171
172
|
- lib/cbor-diagnostic-app/hash.rb
|
|
172
173
|
- lib/cbor-diagnostic-app/nan.rb
|
|
174
|
+
- lib/cbor-diagnostic-app/same.rb
|
|
173
175
|
- lib/cbor-diagnostic-helper.rb
|
|
174
176
|
- lib/cbor-diagnostic-parser.rb
|
|
175
177
|
- lib/cbor-diagnostic.rb
|
|
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
197
199
|
- !ruby/object:Gem::Version
|
|
198
200
|
version: '0'
|
|
199
201
|
requirements: []
|
|
200
|
-
rubygems_version: 4.0.
|
|
202
|
+
rubygems_version: 4.0.8
|
|
201
203
|
specification_version: 4
|
|
202
204
|
summary: CBOR (Concise Binary Object Representation) diagnostic notation
|
|
203
205
|
test_files: []
|