json-ld 2.1.6 → 2.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/json/ld/context.rb +2 -1
- data/lib/json/ld/expand.rb +5 -1
- data/spec/expand_spec.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6faa8c0a2b65b20cfeaa22ac3cba60cf98ae835
|
4
|
+
data.tar.gz: 9e116d70b8081c39e5b725e9053a7b40b1ecfd57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4990f799a5dd3898ce3ea7b746a96f2bf84baab2fd7b90c7f08b360cd72bb8a7863bd31e56048ddfd68ca53b4a4c7510e090c9ce49aa637d4f11298020488881
|
7
|
+
data.tar.gz: 6c551095ca9137161f52c8f978c650a144cae1c070df62501a5dbb0323b3ffda0f13a00221cd257babbc09bd00a0c21d99056eece1895d955c64326b6ea935a5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.7
|
data/lib/json/ld/context.rb
CHANGED
@@ -113,6 +113,7 @@ module JSON::LD
|
|
113
113
|
def container_mapping=(mapping)
|
114
114
|
mapping = Array(mapping)
|
115
115
|
if @as_set = mapping.include?('@set')
|
116
|
+
mapping = mapping.dup
|
116
117
|
mapping.delete('@set')
|
117
118
|
end
|
118
119
|
@container_mapping = mapping.first
|
@@ -1616,7 +1617,7 @@ module JSON::LD
|
|
1616
1617
|
"'@container' on term #{term.inspect} must be a string: #{container.inspect}"
|
1617
1618
|
end
|
1618
1619
|
|
1619
|
-
val = Array(container)
|
1620
|
+
val = Array(container).dup
|
1620
1621
|
val.delete('@set') if has_set = val.include?('@set')
|
1621
1622
|
|
1622
1623
|
raise JsonLdError::InvalidContainerMapping,
|
data/lib/json/ld/expand.rb
CHANGED
@@ -32,7 +32,11 @@ module JSON::LD
|
|
32
32
|
raise JsonLdError::ListOfLists,
|
33
33
|
"A list may not contain another list" if
|
34
34
|
is_list && (v.is_a?(Array) || list?(v))
|
35
|
-
|
35
|
+
case v
|
36
|
+
when nil then nil
|
37
|
+
when Array then memo.concat(v)
|
38
|
+
else memo << v
|
39
|
+
end
|
36
40
|
end
|
37
41
|
|
38
42
|
value
|
data/spec/expand_spec.rb
CHANGED
@@ -637,6 +637,29 @@ describe JSON::LD::API do
|
|
637
637
|
"http://example.com/foo" => []
|
638
638
|
}]
|
639
639
|
},
|
640
|
+
"Free-floating values in sets" => {
|
641
|
+
input: %({
|
642
|
+
"@context": {"property": "http://example.com/property"},
|
643
|
+
"@graph": [{
|
644
|
+
"@set": [
|
645
|
+
"free-floating strings in set objects are removed",
|
646
|
+
{"@id": "http://example.com/free-floating-node"},
|
647
|
+
{
|
648
|
+
"@id": "http://example.com/node",
|
649
|
+
"property": "nodes with properties are not removed"
|
650
|
+
}
|
651
|
+
]
|
652
|
+
}]
|
653
|
+
}),
|
654
|
+
output: %([{
|
655
|
+
"@id": "http://example.com/node",
|
656
|
+
"http://example.com/property": [
|
657
|
+
{
|
658
|
+
"@value": "nodes with properties are not removed"
|
659
|
+
}
|
660
|
+
]
|
661
|
+
}])
|
662
|
+
}
|
640
663
|
}.each do |title, params|
|
641
664
|
it(title) {run_expand params}
|
642
665
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-ld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|