cbor-diag 0.5.12 → 0.5.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3528a462928a5e354625093ab38377abd4591b29b8d9c1b999ec8dc46c4b71ce
4
- data.tar.gz: 727c825e585e16487d995a4d501726bbe383f26221a2747e6a1b0945fa8ef1dd
3
+ metadata.gz: 9b0da5131896552d6bd336a401413b35987ce36a8a007a4f495f6be129bb96b9
4
+ data.tar.gz: a3e51b152b59cadf5b5dda60c1bc2cfc7b8356cccced607ae5b7f5998945b60c
5
5
  SHA512:
6
- metadata.gz: 46c6dbc28aaf1c2dc8938206ff90b66ab9920b6822dbf47ddbcdb32d465d76c5233400d4401625df25e1c4b99d1afd335b30277c2aee253940abf471ac7c1eee
7
- data.tar.gz: '029468920932c7d281d03c11030611c363a275db28386e4db273f57e729841cc822ef18bfd704a5f6f825ce7ff8a1e184095127f4721b828b35dea7f859d584e'
6
+ metadata.gz: 9939f8edabf591e7e17bf0294589e6208e44f4656ed59c62cabc562e295fc765b2075391320ff51e0fd499c24f305ae372de450d6461f9b68e8d47d0be8575d6
7
+ data.tar.gz: 57c99ecad423f8c1a556a5e40e24aac0f5fb0fb6efcedb1d3c35ceac94a27a67aabe7215d31f6dc9e57e36633fe69cd81faa903402cb2b78f0030459bcea4d09
@@ -4,8 +4,4 @@ require 'cbor-pretty'
4
4
 
5
5
  ARGF.binmode
6
6
  i = ARGF.read
7
- while !i.empty?
8
- o, ni = CBOR.decode_with_rest(i)
9
- puts CBOR::pretty(i[0...i.size-ni.size])
10
- i = ni
11
- end
7
+ puts CBOR::pretty_seq(i)
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.5.12"
3
+ s.version = "0.5.13"
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-pretty.rb CHANGED
@@ -17,6 +17,15 @@ module CBOR
17
17
  Buffer.new(s).pretty_item_final(indent, max_target)
18
18
  end
19
19
 
20
+ def self.pretty_seq(s, indent = 0, max_target = 40)
21
+ b = Buffer.new(s)
22
+ res = '' # XXX: not all indented the same
23
+ while !b.empty?
24
+ res << b.pretty_item_final(indent, max_target, true)
25
+ end
26
+ res
27
+ end
28
+
20
29
  class Buffer
21
30
 
22
31
  def take_and_print(n, prefix = '')
@@ -72,11 +81,13 @@ module CBOR
72
81
  nil
73
82
  end
74
83
 
75
- def pretty_item_final(indent = 0, max_target = 40)
84
+ def pretty_item_final(indent = 0, max_target = 40, seq = false)
76
85
  @out = ''
77
86
  @indent = indent
78
87
  pretty_item
79
- raise if @pos != @buffer.size
88
+ unless seq
89
+ raise if @pos != @buffer.size
90
+ end
80
91
  target = [@out.each_line.map {|ln| ln =~ /#/ || 0}.max, max_target].min
81
92
  @out.each_line.map {|ln|
82
93
  col = ln =~ /#/
data/lib/cbor-pure.rb CHANGED
@@ -314,6 +314,10 @@ module CBOR
314
314
  ret
315
315
  end
316
316
 
317
+ def empty?
318
+ @pos == buffer.size
319
+ end
320
+
317
321
 
318
322
  end
319
323
 
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.5.12
4
+ version: 0.5.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-18 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler