emp_json 1.1.0 → 1.2.0
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/Gemfile.lock +1 -1
- data/lib/empathy/emp_json/helpers/primitives.rb +5 -8
- data/lib/empathy/emp_json/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1be366fe90935e2183bfcebab791742f36bda1eb0d2b4b957d3f8712c8e5021a
|
|
4
|
+
data.tar.gz: 1e5def92984e8327e5a46712e9c3c615093535eed826f5cd7e406122036274b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53fdb4ad35c3cb6229bc91f0c78db2ebbf29bcfb7286c905b136f4d0f68282fd32701e7df7159dc9517bbeda1b27659b54e9ce9be4763d8d6f188bc14f34029f
|
|
7
|
+
data.tar.gz: d3b8fd2957612cb2fe6a7c508dceb09b9583d1fc9eae67fc065c357b6278de13e0cc6e6a94ca2e9ee9aab757b743a0f354134bde14a0000795a34c619166a887
|
data/Gemfile.lock
CHANGED
|
@@ -6,7 +6,7 @@ module Empathy
|
|
|
6
6
|
module EmpJson
|
|
7
7
|
module Helpers
|
|
8
8
|
# Functions relating to serializing primitives.
|
|
9
|
-
module Primitives
|
|
9
|
+
module Primitives
|
|
10
10
|
EMP_TYPE_GLOBAL_ID = "id"
|
|
11
11
|
EMP_TYPE_LOCAL_ID = "lid"
|
|
12
12
|
EMP_TYPE_DATETIME = "dt"
|
|
@@ -21,7 +21,6 @@ module Empathy
|
|
|
21
21
|
RDF_RDFV_LANGSTRING = "#{RDF_RDFV}langString"
|
|
22
22
|
RDF_RDFS = "http://www.w3.org/2000/01/rdf-schema#"
|
|
23
23
|
RDF_XSD = "http://www.w3.org/2001/XMLSchema#"
|
|
24
|
-
RDF_XSD_TOKEN = "#{RDF_XSD}token"
|
|
25
24
|
RDF_XSD_STRING = "#{RDF_XSD}string"
|
|
26
25
|
RDF_XSD_DATETIME = "#{RDF_XSD}dateTime"
|
|
27
26
|
RDF_XSD_BOOLEAN = "#{RDF_XSD}boolean"
|
|
@@ -39,7 +38,7 @@ module Empathy
|
|
|
39
38
|
shorthand(EMP_TYPE_LOCAL_ID, "_:#{value.id}")
|
|
40
39
|
end
|
|
41
40
|
|
|
42
|
-
def primitive_to_value(value) # rubocop:disable Metrics/MethodLength, Metrics/
|
|
41
|
+
def primitive_to_value(value) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
|
43
42
|
throw_unknown_ruby_object(value) if value.nil?
|
|
44
43
|
|
|
45
44
|
case value
|
|
@@ -49,12 +48,10 @@ module Empathy
|
|
|
49
48
|
shorthand(EMP_TYPE_GLOBAL_ID, value.to_s)
|
|
50
49
|
when DateTime, ActiveSupport::TimeWithZone
|
|
51
50
|
shorthand(EMP_TYPE_DATETIME, value.iso8601)
|
|
52
|
-
when String
|
|
53
|
-
shorthand(EMP_TYPE_STRING, value)
|
|
51
|
+
when String, Symbol
|
|
52
|
+
shorthand(EMP_TYPE_STRING, value.to_s)
|
|
54
53
|
when true, false
|
|
55
54
|
shorthand(EMP_TYPE_BOOL, value.to_s)
|
|
56
|
-
when Symbol
|
|
57
|
-
primitive(RDF_XSD_TOKEN, value.to_s)
|
|
58
55
|
when Integer
|
|
59
56
|
integer_to_value(value)
|
|
60
57
|
when Float, Numeric
|
|
@@ -94,7 +91,7 @@ module Empathy
|
|
|
94
91
|
when RDF_XSD_INTEGER
|
|
95
92
|
integer_to_value(value.to_i)
|
|
96
93
|
else
|
|
97
|
-
throw "unknown RDF::Literal"
|
|
94
|
+
throw "unknown RDF::Literal: #{value.datatype}"
|
|
98
95
|
end
|
|
99
96
|
end
|
|
100
97
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: emp_json
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thom van Kalkeren
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-06-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Serializer for the EmpJson specification.
|
|
14
14
|
email:
|