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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c980a0bd41e0236610d10af6521e6e41ed39329973c51acdaf48a5567e6162a
4
- data.tar.gz: a260ad775292dfbdc03c25a2d9472164687b918d73f85af4706a1cad7e31f367
3
+ metadata.gz: 1be366fe90935e2183bfcebab791742f36bda1eb0d2b4b957d3f8712c8e5021a
4
+ data.tar.gz: 1e5def92984e8327e5a46712e9c3c615093535eed826f5cd7e406122036274b1
5
5
  SHA512:
6
- metadata.gz: 2b7c38569fc8700ea138d1fb0fc6dfb82caee3b8c3e805f50d5c06a7912f1bba3233c568980b4614d9d8ac4477ced6fb07dfdb3482fa00ec4eafbb69722500af
7
- data.tar.gz: 591b643b63e2d0e497c7ba8c0989518a357b34d0b3d36b04b72872d9c11637bf5a28215aeb23f779ba5066c939bd72ad680d7e68d3d00c1b70d0dc27fb5c92e3
6
+ metadata.gz: 53fdb4ad35c3cb6229bc91f0c78db2ebbf29bcfb7286c905b136f4d0f68282fd32701e7df7159dc9517bbeda1b27659b54e9ce9be4763d8d6f188bc14f34029f
7
+ data.tar.gz: d3b8fd2957612cb2fe6a7c508dceb09b9583d1fc9eae67fc065c357b6278de13e0cc6e6a94ca2e9ee9aab757b743a0f354134bde14a0000795a34c619166a887
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- emp_json (1.1.0)
4
+ emp_json (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -6,7 +6,7 @@ module Empathy
6
6
  module EmpJson
7
7
  module Helpers
8
8
  # Functions relating to serializing primitives.
9
- module Primitives # rubocop:disable Metrics/ModuleLength
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/CyclomaticComplexity, Metrics/AbcSize
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Empathy
4
4
  module EmpJson
5
- VERSION = "1.1.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
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.1.0
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-05-31 00:00:00.000000000 Z
11
+ date: 2022-06-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Serializer for the EmpJson specification.
14
14
  email: