edn-abnf 0.5.5 → 0.5.6

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/edn-abnf +13 -5
  3. data/edn-abnf.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5dfe85683dcf245892881927e2282ef6d37f7cf4f1af908fd0d42311f1ab3df0
4
- data.tar.gz: 4b1f2852badbe29367e0a2a74e21fb7c0a66991b29a1770ad9b6828fc4a5c007
3
+ metadata.gz: 3af63aa900f9f717d9f2d2a50a15ee315d7e6c08c6c1a25cf774b4ee2d9b1582
4
+ data.tar.gz: a3e7fccd19e0b3ce9858d023dc1217c65b624be46a88561078b32c9a3f626a9f
5
5
  SHA512:
6
- metadata.gz: 6cf2a94c9c99cc4d8514bcc43cd6510e9680039f32f56424ac3591acbe7124b074c3cc7fb86a9bd121a353d268adb6e72aef1fa0dad18439f4ee8b52de5834a2
7
- data.tar.gz: b073d04f739667786be52f5a97dde7889573f9630a111f44528e0664fe3ae0a9cce8333f5b1e846833629018d363b1492464c3d976788d72b8ffa05f90719914
6
+ metadata.gz: 9a1c93950df83082da957bfeb9b3989981615d15c48100af5f01682532496d93d5191e5ce435b0c747c7107c86a3d9cc072e3c4f6d08296ccfa6431d42d38322
7
+ data.tar.gz: 7f3feae2f8db35a1206527a8b4142dfa7f28e276a85b0cad8f1b931a8c3e713a622f6dd6b3e2f35d05a0e6e6db79225eb33f387e51f364e317b80ca0f67fe76a
data/bin/edn-abnf CHANGED
@@ -34,6 +34,8 @@ require 'ostruct'
34
34
 
35
35
  $error = 0
36
36
 
37
+ output_formats = [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex, :cbor]
38
+
37
39
  $options = OpenStruct.new
38
40
  begin
39
41
  op = OptionParser.new do |opts|
@@ -53,8 +55,8 @@ begin
53
55
  $options.edn = v
54
56
  end
55
57
  opts.on("-tFMT", "--to=FMT",
56
- [:basic, :neat, :json, :yaml, :edn, :diag, :pretty, :hex],
57
- "Target format (default: diag)") do |v|
58
+ output_formats,
59
+ "Target format (#{output_formats.join("/")}, default: diag)") do |v|
58
60
  $options.target = v
59
61
  end
60
62
  opts.on("-aAPP", "--app=APP", "Load application extension") do |v|
@@ -165,17 +167,23 @@ when :yaml
165
167
  puts result.to_yaml
166
168
  when :edn, :diag, nil
167
169
  puts result.cbor_diagnostic
168
- when :pretty, :hex
170
+ when :pretty, :hex, :cbor
169
171
  # XXX can't do Box yet
170
172
  enc = if CBOR::Sequence === result
171
173
  result.to_cborseq
172
174
  else
173
175
  result.to_cbor
174
176
  end
175
- if $options.target == :pretty
177
+ case $options.target
178
+ when :pretty
176
179
  puts CBOR::pretty_seq(enc)
177
- else
180
+ when :hex
178
181
  puts enc.bytes.map{|x| "%02x" % x}.join
182
+ when :cbor
183
+ $stdout.binmode
184
+ print enc
185
+ else
186
+ fail "Cannot happen"
179
187
  end
180
188
  else
181
189
  warn ["Unknown target format: ", $options.target].inspect
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.5"
3
+ s.version = "0.5.6"
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"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edn-abnf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carsten Bormann
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-29 00:00:00.000000000 Z
10
+ date: 2025-05-15 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler