edn-abnf 0.5.38 → 0.5.39

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66e20181db646536c0fa4eabd1527ba580085825de03eb89e0e26f4437e215ed
4
- data.tar.gz: 15e82108df4dede7ab0dc29bebbfc7c6fc5e6e028a3a16de86615d3691c6db9d
3
+ metadata.gz: 17c5fde6eec17c35da2e94196c5eb582ef05e8586c997c38b989f044460c9a03
4
+ data.tar.gz: 964e47d82a247a6b17a0b479a8b2ac1dacf284baa5068a4458938726980de944
5
5
  SHA512:
6
- metadata.gz: a95ef3f7c9c857cdbff5b6d1e60854fc6c268afc3d98052c3f236686505cd10b62e6e52e8f320b35b0514039b0e77d1fb3ab09f4bc561dd4741654970fa1d4b0
7
- data.tar.gz: 72ba10c6341a342dc2b19030fb0d0993094564fc398c24ec8673911ce9453eca0950e7a954829c413c348e71625481038612025a3a34cc506d346e99580b0776
6
+ metadata.gz: 1d1b16c8fcc99e5cad651830b0ddb515b1321b2f177951376128fc26fc62fd5afbf1848a119876ad54557042192dea72a679bffc3b4d1bd515bc41b2520c4558
7
+ data.tar.gz: 8bc3c115e0b0576c4796d65846064747a7254fd9e9082ca4a99048d3130f485134a8fdd5a40d677a2239b50acb7b3a9d69c69c0a0c52609f43ecbc8a71881a4e
data/edn-abnf.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "edn-abnf"
3
- s.version = "0.5.38"
3
+ s.version = "0.5.39"
4
4
  s.summary = "CBOR Extended Diagnostic Notation (EDN) implemented in ABNF"
5
5
  s.description = %q{edn-abnf implements converters and miscellaneous tools for CBOR EDN's ABNF}
6
6
  s.author = "Carsten Bormann"
@@ -66,6 +66,7 @@ module CBOR
66
66
  class Xbox < Box
67
67
  def encoding; value.encoding end
68
68
  def size; value.size end
69
+ def b; value.b end
69
70
  def to_cbor
70
71
  enc = CBOR.encode(value)
71
72
  if ei = options[:ei]
@@ -0,0 +1,32 @@
1
+ require "cbor-diagnostic-app/0"
2
+
3
+ class CBOR_DIAG::Helper
4
+ def self.decode_string(app_prefix, s, to_text = false)
5
+ ret = if CBOR::Sequence === s
6
+ args = s.elements
7
+ else
8
+ args = [s]
9
+ end.map { |el|
10
+ unless String === el || el.respond_to?(:value) && String === el.value
11
+ raise ArgumentError.new("cbor-diagnostic: #{app_prefix}<<>>: #{el.cbor_diagnostic} not a string: Argument Error")
12
+ end
13
+ el.b
14
+ }.join.b # .b needed so empty array becomes byte string, too
15
+ if to_text
16
+ ret = ret.force_encoding(Encoding::UTF_8)
17
+ end
18
+ ret
19
+ end
20
+ end
21
+
22
+ class CBOR_DIAG::App_b1
23
+ def self.decode(app_prefix, s)
24
+ CBOR_DIAG::Helper.decode_string(app_prefix, s, false)
25
+ end
26
+ end
27
+
28
+ class CBOR_DIAG::App_t1
29
+ def self.decode(app_prefix, s)
30
+ CBOR_DIAG::Helper.decode_string(app_prefix, s, true)
31
+ end
32
+ end
@@ -111,8 +111,9 @@ class Treetop::Runtime::SyntaxNode
111
111
  end
112
112
  end
113
113
 
114
-
115
- require 'cbor-diagnostic-app/dt'
116
- require 'cbor-diagnostic-app/ip'
114
+ # MTI app-extensions:
117
115
  require 'cbor-diagnostic-app/h'
118
116
  require 'cbor-diagnostic-app/b64'
117
+ require 'cbor-diagnostic-app/dt'
118
+ require 'cbor-diagnostic-app/ip'
119
+ require 'cbor-diagnostic-app/t1_b1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edn-abnf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.38
4
+ version: 0.5.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
@@ -112,6 +112,7 @@ files:
112
112
  - lib/cbor-diagnostic-app/hgrammar.rb
113
113
  - lib/cbor-diagnostic-app/ip.rb
114
114
  - lib/cbor-diagnostic-app/ipgrammar.rb
115
+ - lib/cbor-diagnostic-app/t1_b1.rb
115
116
  - lib/cbor-diagnostic-app/zzz.rb
116
117
  - lib/edn-abnf.rb
117
118
  - lib/parser/edn-util.rb