cbor-diag 0.8.1 → 0.8.2
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-pretty.rb +8 -3
 - 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: fd65812eff17fff91777d0c28f076a1fa5f65dd0a972980243e8a324f1e822a0
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 85d593a5feb8593d0e4b24a73078aa68718208b81bb8c00836e711990a5c9d48
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 14a85c16fdbd914650a52bd982dddef3991e83cae52b504355dcb536be3c9eea91b14bac25d84b98e57f5daa986e76dcd420d81b1f3aebf8e81becf6d63b7e64
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9b24cf004311b95c512b866f71b9c05dadab3c5e676f835eac3a305f32e0cce81bae36f12ea10381918cfd3415af2ea9b644e054981bdf7de162edc1d28ddcbe
         
     | 
    
        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.8. 
     | 
| 
      
 3 
     | 
    
         
            +
              s.version = "0.8.2"
         
     | 
| 
       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-pretty.rb
    CHANGED
    
    | 
         @@ -13,6 +13,11 @@ class String 
     | 
|
| 
       13 
13 
     | 
    
         
             
              def hexbytes(sep = '')
         
     | 
| 
       14 
14 
     | 
    
         
             
                bytes.map{|x| HEX_FORMAT % x}.join(sep)
         
     | 
| 
       15 
15 
     | 
    
         
             
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
              def to_json_514_workaround
         
     | 
| 
      
 17 
     | 
    
         
            +
                ret = to_json
         
     | 
| 
      
 18 
     | 
    
         
            +
                ret.encode(Encoding::UTF_16BE) # exception if bad
         
     | 
| 
      
 19 
     | 
    
         
            +
                ret
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
       16 
21 
     | 
    
         
             
            end
         
     | 
| 
       17 
22 
     | 
    
         | 
| 
       18 
23 
     | 
    
         | 
| 
         @@ -76,7 +81,7 @@ module CBOR 
     | 
|
| 
       76 
81 
     | 
    
         
             
                when 2, 3
         
     | 
| 
       77 
82 
     | 
    
         
             
                  @out << '   ' * (@indent)
         
     | 
| 
       78 
83 
     | 
    
         
             
                  s = take_and_print(val)
         
     | 
| 
       79 
     | 
    
         
            -
                  @out << " # #{s.force_encoding(Encoding::UTF_8). 
     | 
| 
      
 84 
     | 
    
         
            +
                  @out << " # #{s.force_encoding(Encoding::UTF_8).to_json_514_workaround rescue s.inspect}"
         
     | 
| 
       80 
85 
     | 
    
         
             
                  @out << "\n"
         
     | 
| 
       81 
86 
     | 
    
         
             
                when 4; val.times { pretty_item }
         
     | 
| 
       82 
87 
     | 
    
         
             
                when 5; val.times { pretty_item; pretty_item}
         
     | 
| 
         @@ -92,9 +97,9 @@ module CBOR 
     | 
|
| 
       92 
97 
     | 
    
         
             
                unless seq
         
     | 
| 
       93 
98 
     | 
    
         
             
                  raise if @pos != @buffer.size
         
     | 
| 
       94 
99 
     | 
    
         
             
                end
         
     | 
| 
       95 
     | 
    
         
            -
                target = [@out.each_line.map {|ln| ln  
     | 
| 
      
 100 
     | 
    
         
            +
                target = [@out.each_line.map {|ln| ln.index('#') || 0}.max, max_target].min
         
     | 
| 
       96 
101 
     | 
    
         
             
                @out.each_line.map {|ln|
         
     | 
| 
       97 
     | 
    
         
            -
                  col = ln 
     | 
| 
      
 102 
     | 
    
         
            +
                  col = ln.index('#')
         
     | 
| 
       98 
103 
     | 
    
         
             
                  if col && col < target
         
     | 
| 
       99 
104 
     | 
    
         
             
                    ln[col, 0] = ' ' * (target - col)
         
     | 
| 
       100 
105 
     | 
    
         
             
                  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.8. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.8.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Carsten Bormann
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-02-02 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.4.2
         
     | 
| 
       194 
194 
     | 
    
         
             
            signing_key:
         
     | 
| 
       195 
195 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       196 
196 
     | 
    
         
             
            summary: CBOR (Concise Binary Object Representation) diagnostic notation
         
     |