cbor-diag 0.7.3 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cbor-diag.gemspec +1 -1
- data/lib/cbor-diagnostic.rb +4 -3
- data/lib/cbor-pretty.rb +2 -1
- data/lib/cbor-transform-j.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94b3574121e832e41781f99faacfb3d3bb0e1e444df3fce1b6cd70f58329e690
|
4
|
+
data.tar.gz: e1652badb328ae93c6037c264a46c5960172f20e84f2f23685bdc9f6bcce846c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d7e56e106693d746602e936772d15d2aefce325fea284a9ddcc4eecf0e79333c05577f2f4a0fa2600f7e415ab947df01b5ee0c4a67964f2b5de1559e9430331
|
7
|
+
data.tar.gz: '09425230ba25ffe5b99e3725ad62408f893ee60257493ce3b4ea125254a4bdf6dd1fd36ccd9b846c028e570dce74f7e8147dde98488c864ed3e16c44b50a5a1f'
|
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.7.
|
3
|
+
s.version = "0.7.6"
|
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"
|
data/lib/cbor-diagnostic.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
unless defined?(CBOR)
|
3
3
|
require 'cbor-pure'
|
4
4
|
end
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
class Object
|
7
8
|
def cbor_diagnostic(_=nil)
|
@@ -55,7 +56,7 @@ class String
|
|
55
56
|
result << dv
|
56
57
|
end
|
57
58
|
return "<< #{result.map{|x| x.cbor_diagnostic(options)}.join(", ")} >>"
|
58
|
-
rescue
|
59
|
+
rescue StandardError => e
|
59
60
|
# that didn't work out, so continue with other options
|
60
61
|
# puts e.backtrace
|
61
62
|
end
|
@@ -67,9 +68,9 @@ class String
|
|
67
68
|
end
|
68
69
|
else
|
69
70
|
if options[:utf8]
|
70
|
-
|
71
|
+
to_json
|
71
72
|
else
|
72
|
-
|
73
|
+
to_json.encode(Encoding::UTF_16BE).bytes.each_slice(2).map {
|
73
74
|
|c1, c2| c = (c1 << 8)+c2; c < 128 ? c.chr : '\u%04x' % c }.join
|
74
75
|
end
|
75
76
|
end
|
data/lib/cbor-pretty.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
unless defined?(CBOR)
|
5
5
|
require 'cbor-pure'
|
6
6
|
end
|
7
|
+
require 'json'
|
7
8
|
|
8
9
|
UPPERCASE_HEX = ENV["UPPERCASE_HEX"]
|
9
10
|
HEX_FORMAT = UPPERCASE_HEX ? "%02X" : "%02x"
|
@@ -75,7 +76,7 @@ module CBOR
|
|
75
76
|
when 2, 3
|
76
77
|
@out << ' ' * (@indent)
|
77
78
|
s = take_and_print(val)
|
78
|
-
@out << " # #{s.inspect}"
|
79
|
+
@out << " # #{s.force_encoding(Encoding::UTF_8).to_json rescue s.inspect}"
|
79
80
|
@out << "\n"
|
80
81
|
when 4; val.times { pretty_item }
|
81
82
|
when 5; val.times { pretty_item; pretty_item}
|
data/lib/cbor-transform-j.rb
CHANGED
@@ -51,7 +51,7 @@ class CBOR::Transform_jr < CBOR::Transform
|
|
51
51
|
when "b"
|
52
52
|
::Base64.urlsafe_decode64(value)
|
53
53
|
when /\At(\d+)\z/
|
54
|
-
CBOR::Tagged.new($1.to_i, value)
|
54
|
+
CBOR::Tagged.new($1.to_i, transform(value))
|
55
55
|
else
|
56
56
|
fail ArgumentError.new("Unknown CBOR-JSON encoding @@!#{cookie}")
|
57
57
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cbor-diag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.3.3
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: CBOR (Concise Binary Object Representation) diagnostic notation
|