cbor-diag 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pretty2cbor.rb +10 -0
- data/bin/yaml2cbor.rb +15 -0
- data/cbor-diag.gemspec +1 -1
- data/lib/cbor-pure.rb +7 -2
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 878d675b3f7f6e5f8f352fa4f6add752bba8dd0b
|
4
|
+
data.tar.gz: 7cb35a91b219b057abcab0b06c21a44a82ad8c25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7e7cac5754327ee644345d61b31f6a187c1ec990d04b21292bcd5f6bffc698c6c956749875bbe37c734bd83e49e06bf377316939fc16427178110bc542b08bc
|
7
|
+
data.tar.gz: bdabdc08e7e9922033b445e10e7d64ec3bf3d7979aeadd35406aa20219a4b189823c09835ef8570fc6a600c1b466206690a1fc9b77d55538d40201f86f1563d3
|
data/bin/pretty2cbor.rb
ADDED
data/bin/yaml2cbor.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'psych.rb' # WTF
|
3
|
+
require 'yaml'
|
4
|
+
require 'cbor-pure'
|
5
|
+
|
6
|
+
if ARGV[0] == "-v"
|
7
|
+
verbose = true
|
8
|
+
ARGV.shift
|
9
|
+
end
|
10
|
+
|
11
|
+
$stdout.binmode
|
12
|
+
i = ARGF.read
|
13
|
+
o = CBOR.encode(YAML.load(i))
|
14
|
+
print o
|
15
|
+
warn "YAML size: #{i.size} bytes, CBOR size: #{o.size} bytes." if verbose
|
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.2.
|
3
|
+
s.version = "0.2.4"
|
4
4
|
s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
|
5
5
|
s.description = %q{cbor-diag implements diagnostic notation for CBOR, RFC 7049}
|
6
6
|
s.author = "Carsten Bormann"
|
data/lib/cbor-pure.rb
CHANGED
@@ -182,6 +182,11 @@ class CBOR
|
|
182
182
|
self
|
183
183
|
end
|
184
184
|
|
185
|
+
def atleast(n)
|
186
|
+
left = @buffer.bytesize - @pos
|
187
|
+
raise OutOfBytesError.new(n - left) if n > left
|
188
|
+
end
|
189
|
+
|
185
190
|
def take(n)
|
186
191
|
opos = @pos
|
187
192
|
@pos += n
|
@@ -257,8 +262,8 @@ class CBOR
|
|
257
262
|
end
|
258
263
|
when 2; take(val).force_encoding(Encoding::BINARY)
|
259
264
|
when 3; take(val).force_encoding(Encoding::UTF_8)
|
260
|
-
when 4; Array.new(val) { decode_item }
|
261
|
-
when 5; Hash[Array.new(val) {[decode_item, decode_item]}]
|
265
|
+
when 4; atleast(val); Array.new(val) { decode_item }
|
266
|
+
when 5; atleast(val<<1); Hash[Array.new(val) {[decode_item, decode_item]}]
|
262
267
|
end
|
263
268
|
end
|
264
269
|
|
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Bormann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07
|
11
|
+
date: 2016-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -63,6 +63,8 @@ executables:
|
|
63
63
|
- diag2pretty.rb
|
64
64
|
- json2cbor.rb
|
65
65
|
- json2pretty.rb
|
66
|
+
- pretty2cbor.rb
|
67
|
+
- yaml2cbor.rb
|
66
68
|
extensions: []
|
67
69
|
extra_rdoc_files: []
|
68
70
|
files:
|
@@ -74,6 +76,8 @@ files:
|
|
74
76
|
- bin/diag2pretty.rb
|
75
77
|
- bin/json2cbor.rb
|
76
78
|
- bin/json2pretty.rb
|
79
|
+
- bin/pretty2cbor.rb
|
80
|
+
- bin/yaml2cbor.rb
|
77
81
|
- cbor-diag.gemspec
|
78
82
|
- lib/cbor-diag-parser.rb
|
79
83
|
- lib/cbor-diagnostic.rb
|
@@ -100,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
104
|
version: '0'
|
101
105
|
requirements: []
|
102
106
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.6.7
|
104
108
|
signing_key:
|
105
109
|
specification_version: 4
|
106
110
|
summary: CBOR (Concise Binary Object Representation) diagnostic notation
|