cbor-diag-e 0.0.3 → 0.0.4

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: 95a2a1bf8964e7de376d3bfc20aeceac3e9be3017fd2dc21ae77fc2c3d995a32
4
- data.tar.gz: b1aa00e2ddbdd43b70ff763f2d96bf1df79e62670d2b8def4f81b602fd025c02
3
+ metadata.gz: 2f86a688b315b2cd89e22c5e1aec5034d12ebd7b85d1af9385d093bbdd3cb452
4
+ data.tar.gz: 3309fc819618f80e68e54f806eb45b40d1cca6b5e076855b9e45596e137246eb
5
5
  SHA512:
6
- metadata.gz: 99bb6811c234c3e32890c3b4d06a06f122b0c4d83d419e5cdb8671f09da491ecdfd0e41699271b980a73566f646fefa25ebdf326e7898de45c486e6c1b894d12
7
- data.tar.gz: 1377464d07cda76bd0e4e203f2d2f93e7042405e089c12ce1fb226e6f09e75c5959237d30905b9ac3c01ebbc9b2da9cd5c9654182230280d23233722db626e5b
6
+ metadata.gz: 567be10315168576433a025d3d52866bce95dfdef82e67a36bd38ed811e5fccacf01d673f7534bdf2f562fa26c77780a2b4e4f342ad6c84513f2060900391b0f
7
+ data.tar.gz: 569d5c15156f0f62007c74af2c323d2fb031ab8fbbdaad6a80d41557ad2e3b7e7bfd1e44fa161f6230b640b25d44e8d9e2b4598c6e3f3bd18f5bc2c8ec494a0e
data/cbor-diag-e.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cbor-diag-e"
3
- s.version = "0.0.3"
3
+ s.version = "0.0.4"
4
4
  s.summary = "CBOR (Concise Binary Object Representation) diagnostic notation"
5
5
  s.description = %q{cbor-diag-e implements external constants for CBOR diagnostic notation}
6
6
  s.author = "Carsten Bormann"
@@ -5,16 +5,21 @@ require 'yaml'
5
5
 
6
6
  class CBOR_DIAG::App_e
7
7
  CBOR_DIAG_CDDL_NAME = ENV["CBOR_DIAG_CDDL"]
8
- raise "e'...': No CBOR_DIAG_CDDL given" unless CBOR_DIAG_CDDL_NAME
9
8
 
10
- cddlcs, status = Open3.capture2("cddlc -2tconst #{Shellwords.escape(CBOR_DIAG_CDDL_NAME)}")
11
- raise "e'...': cannot run cddlc" unless status.success?
12
- CONSTS_MAP = YAML.load(cddlcs)
9
+ def self.consts_map(s)
10
+ @cached_consts_map ||= (
11
+ raise "e'#{s}': No CBOR_DIAG_CDDL file name given in environment" unless CBOR_DIAG_CDDL_NAME
12
+
13
+ cddlcs, status = Open3.capture2("cddlc -2tconst #{Shellwords.escape(CBOR_DIAG_CDDL_NAME)}")
14
+ raise "e'#{s}': Cannot run cddlc on #{CBOR_DIAG_CDDL_NAME.inspect}" unless status.success?
15
+ YAML.load(cddlcs)
16
+ )
17
+ end
13
18
 
14
19
  def self.decode(_, s)
15
- CONSTS_MAP.fetch(s) do
20
+ consts_map(s).fetch(s) do
16
21
  construct = "e'#{s}'"
17
- warn "*** e'...': No external constant value defined for #{construct}"
22
+ warn "*** #{construct}: No external constant value defined in #{CBOR_DIAG_CDDL_NAME.inspect}"
18
23
  construct
19
24
  end
20
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cbor-diag-e
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.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: 2024-03-01 00:00:00.000000000 Z
11
+ date: 2024-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cddlc
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  requirements: []
68
- rubygems_version: 3.4.10
68
+ rubygems_version: 3.5.9
69
69
  signing_key:
70
70
  specification_version: 4
71
71
  summary: CBOR (Concise Binary Object Representation) diagnostic notation