emp_json 1.3.0.pre.g0625fa6de → 1.4.0.pre.g4cafffeae

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: 9612a5c8e0b716176a85c878f90d0bc81fcf9356e18c393ee0c15311e955d688
4
- data.tar.gz: e510d8c6a838de964217deb2d59f2dafbf2ca5f52d30b26499b3be160f1065cc
3
+ metadata.gz: d2cfd4b534090019df728bd1403998dec3dfb37c6028c3f423f4688cfaa4cd8f
4
+ data.tar.gz: 6d312acaac6c1c97bbaba8e9a2c7a5873af24765f7d473866a5745c3c1e98691
5
5
  SHA512:
6
- metadata.gz: 1689dde51a6dd8413688616352278c134de24aa92704223d86ffdd22538cf9d84ff6a690d7a822e997fc1447abb073aa60e625886b735cf8c5a516cc8abcb204
7
- data.tar.gz: d3d6782b0a717f1464b537e9704767f6318ad6ff1a9ed6425e68cf4cdcba2afd554f7f86a6ef82656291dd324b7abb3a84958c68df09c23c5af8d811190b7b88
6
+ metadata.gz: 6ccf00e83ea0fc8da9fb80b989c16dcfd3b34780359bdc5d6e442041c591dafd3066c14abfa68cfd6d72c1fc3012ce9fced3ef8a71c13c6e236bec788fe679c0
7
+ data.tar.gz: 6e9290bbc3c01f72f1b3414a3b74fb2040d547b5fac2762c1ff4ecee1ff1eb40b49e6205319f276cd593c96401417098246842be69ae7dfc13f91d71bc2bbb84
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- emp_json (1.3.0.pre.g0625fa6de)
4
+ emp_json (1.4.0.pre.g4cafffeae)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -14,6 +14,7 @@ module Empathy
14
14
  EMP_TYPE_STRING = "s"
15
15
  EMP_TYPE_BOOL = "b"
16
16
  EMP_TYPE_INTEGER = "i"
17
+ EMP_TYPE_DOUBLE = "d"
17
18
  EMP_TYPE_LONG = "l"
18
19
  EMP_TYPE_PRIMITIVE = "p"
19
20
  EMP_TYPE_LANGSTRING = "ls"
@@ -28,6 +29,8 @@ module Empathy
28
29
  RDF_XSD_DATETIME = "#{RDF_XSD}dateTime"
29
30
  RDF_XSD_BOOLEAN = "#{RDF_XSD}boolean"
30
31
  RDF_XSD_INTEGER = "#{RDF_XSD}integer"
32
+ RDF_XSD_DECIMAL = "#{RDF_XSD}decimal"
33
+ RDF_XSD_DOUBLE = "#{RDF_XSD}double"
31
34
 
32
35
  def object_to_value(value)
33
36
  return primitive_to_value(value.iri) if value.respond_to?(:iri)
@@ -59,7 +62,9 @@ module Empathy
59
62
  shorthand(EMP_TYPE_BOOL, value.to_s)
60
63
  when Integer
61
64
  integer_to_value(value)
62
- when Float, Numeric
65
+ when Float
66
+ shorthand(EMP_TYPE_DOUBLE, value.to_s)
67
+ when Numeric
63
68
  use_rdf_rb_for_primitive(value)
64
69
  when RDF::Literal
65
70
  rdf_literal_to_value(value)
@@ -79,7 +84,7 @@ module Empathy
79
84
  end
80
85
  end
81
86
 
82
- def rdf_literal_to_value(value) # rubocop:disable Metrics/AbcSize
87
+ def rdf_literal_to_value(value) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
83
88
  case value.datatype.to_s
84
89
  when RDF_RDFV_LANGSTRING
85
90
  {
@@ -95,10 +100,14 @@ module Empathy
95
100
  shorthand(EMP_TYPE_DATETIME, value.value)
96
101
  when RDF_XSD_BOOLEAN
97
102
  shorthand(EMP_TYPE_BOOL, value.value)
103
+ when RDF_XSD_DOUBLE
104
+ shorthand(EMP_TYPE_DOUBLE, value.value)
105
+ when RDF_XSD_DECIMAL
106
+ primitive(value.datatype.to_s, value.value)
98
107
  when RDF_XSD_INTEGER
99
108
  integer_to_value(value.to_i)
100
109
  else
101
- throw "unknown RDF::Literal"
110
+ throw "unknown RDF::Literal: #{value.datatype}"
102
111
  end
103
112
  end
104
113
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Empathy
4
4
  module EmpJson
5
- VERSION = "1.3.0"
5
+ VERSION = "1.4.0"
6
6
  end
7
7
  end
@@ -16,6 +16,8 @@ module Empathy
16
16
 
17
17
  EMP_TYPE_INTEGER: "i"
18
18
 
19
+ EMP_TYPE_DOUBLE: "d"
20
+
19
21
  EMP_TYPE_LONG: "l"
20
22
 
21
23
  EMP_TYPE_PRIMITIVE: "p"
@@ -42,6 +44,10 @@ module Empathy
42
44
 
43
45
  RDF_XSD_INTEGER: "http://www.w3.org/2001/XMLSchema#integer"
44
46
 
47
+ RDF_XSD_DECIMAL: "http://www.w3.org/2001/XMLSchema#decimal"
48
+
49
+ RDF_XSD_DOUBLE: "http://www.w3.org/2001/XMLSchema#double"
50
+
45
51
  type shorthand = { type: string, v: string }
46
52
  type primitive = { type: string, dt: string, v: string }
47
53
 
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.3.0.pre.g0625fa6de
4
+ version: 1.4.0.pre.g4cafffeae
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-08-15 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Serializer for the EmpJson specification.
14
14
  email: