edn-abnf 0.0.10 → 0.0.12

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: 932c447340ccec81fa10c0b51f802906872bdbd544473aa6301f98b490ef8aef
4
- data.tar.gz: fa2e2062c8eb6243029011b790e519dd5d24b3fe61960e12cefc4d253d92dd1f
3
+ metadata.gz: f762b42f537b6298556bf2e2988c8612cd26d9315c980ddb9a5e355a678a40c5
4
+ data.tar.gz: 91b77ee973f2d4c23a6a9bb0344a16324e783c47861f7f0929dfd6322dd0f743
5
5
  SHA512:
6
- metadata.gz: df16c6657287cdd6c3c1a717dd7e2e6ab20e64d53a910dc77b9b8f3b7a6dd9a20c3c9330e4d272ce3230f497ef1a936de184a41b35105af15c7a6d27f50c4c90
7
- data.tar.gz: 0ea2cd3c43c44d3ec0c6881558f407fbf0368abceeb66f022f121a45be16aa49d7e23b64f5c66479b9ad804dc07ba36fce78952de603a17f6bc2185ed3fac69d
6
+ metadata.gz: ecb6361fcf84f6de6d7e547093ec2de27d7cc69161d7717ee336db9b39b0b546ce50015dbcfb8ed64d81129d67acdbaa4eb0fcb64751c55fbe10996e9ca61fd1
7
+ data.tar.gz: 8f438a03ee42ea49f1d412b9fe249332acfae759be315a1c6e8f71304fb8159c9161f8267252e9e6f8f463577c2f4c55bfeafff33baae1da7f6c0752d6a131d9
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.0.10"
3
+ s.version = "0.0.12"
4
4
  s.summary = "CDDL (Concise Data Definition Language) converters and miscellaneous tools"
5
5
  s.description = %q{edn-abnf implements converters and miscellaneous tools for CBOR EDN's ABNF}
6
6
  s.author = "Carsten Bormann"
@@ -0,0 +1,25 @@
1
+ require_relative "dtgrammar.rb"
2
+ require 'time'
3
+
4
+ # Using Time#iso8601 creates the following bugs:
5
+ # * dt'1970-01-01T10:00:00' is accepted and gives local time
6
+ # * dt'1970-01-01T10:00:00.0Z' gives an integer instead of a float
7
+ # Probably should copy over Time#xmlschema and fix that for us.
8
+
9
+ class CBOR_DIAG::App_dt
10
+ def self.decode(_, s)
11
+ parser = DTGRAMMARParser.new
12
+ ast = parser.parse(s)
13
+ if !ast
14
+ raise ArgumentError, "cbor-diagnostic: Parse Error in dt'#{s}':\n" << EDN.reason(parser, s)
15
+ end
16
+ # ast.ast
17
+
18
+ t = Time.iso8601(s)
19
+ if t.subsec != 0
20
+ t.to_f
21
+ else
22
+ t.to_i
23
+ end
24
+ end
25
+ end