json-ld 1.1.10 → 1.1.11
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/api.rb +5 -5
- data/lib/json/ld/compact.rb +1 -1
- data/lib/json/ld/context.rb +2 -2
- data/lib/json/ld/expand.rb +1 -1
- data/lib/json/ld/resource.rb +1 -1
- data/lib/json/ld/utils.rb +6 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5154c2b04be740ac97d8e01a44384578ed8aa872
|
4
|
+
data.tar.gz: d027b37fc1dbecf4bed0f14340c87147fb27640b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0205eee6e03bf7c1eae78d27b18288d07462447b468e5d95b74283d4532bf1b21a4494bc0be27f2e1c2f164cdd466b5eca944a61dd03cc8fd24f9100556ca757
|
7
|
+
data.tar.gz: 7e3c65b3576b716c65e00a79d4fa399e05cea9d01d9494283c2d61d2df04eef2caf21e8c8c5094f3f1879adf68fa29a7f6005269b40c442dceaaddac41ad5663
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.11
|
data/lib/json/ld/api.rb
CHANGED
@@ -87,7 +87,7 @@ module JSON::LD
|
|
87
87
|
# @yieldparam [API]
|
88
88
|
# @raise [JsonLdError]
|
89
89
|
def initialize(input, context, options = {}, &block)
|
90
|
-
@options = {compactArrays: true, rename_bnodes: true}.merge(options)
|
90
|
+
@options = {compactArrays: true, rename_bnodes: true}.merge!(options)
|
91
91
|
@options[:validate] = true if @options[:processingMode] == "json-ld-1.0"
|
92
92
|
@options[:documentLoader] ||= self.class.method(:documentLoader)
|
93
93
|
@namer = options[:unique_bnodes] ? BlankNodeUniqer.new : (@options[:rename_bnodes] ? BlankNodeNamer.new("b") : BlankNodeMapper.new)
|
@@ -98,7 +98,7 @@ module JSON::LD
|
|
98
98
|
@value = case input
|
99
99
|
when Array, Hash then input.dup
|
100
100
|
when IO, StringIO
|
101
|
-
@options = {base: input.base_uri}.merge(@options) if input.respond_to?(:base_uri)
|
101
|
+
@options = {base: input.base_uri}.merge!(@options) if input.respond_to?(:base_uri)
|
102
102
|
|
103
103
|
# if input impelements #links, attempt to get a contextUrl from that link
|
104
104
|
content_type = input.respond_to?(:content_type) ? input.content_type : "application/json"
|
@@ -113,7 +113,7 @@ module JSON::LD
|
|
113
113
|
when String
|
114
114
|
remote_doc = @options[:documentLoader].call(input, @options)
|
115
115
|
|
116
|
-
@options = {base: remote_doc.documentUrl}.merge(@options)
|
116
|
+
@options = {base: remote_doc.documentUrl}.merge!(@options)
|
117
117
|
context_ref = remote_doc.contextUrl
|
118
118
|
|
119
119
|
case remote_doc.document
|
@@ -322,7 +322,7 @@ module JSON::LD
|
|
322
322
|
requireAll: true,
|
323
323
|
omitDefault: false,
|
324
324
|
documentLoader: method(:documentLoader)
|
325
|
-
}.merge(options)
|
325
|
+
}.merge!(options)
|
326
326
|
|
327
327
|
framing_state = {
|
328
328
|
graphs: {'@default' => {}, '@merged' => {}},
|
@@ -471,7 +471,7 @@ module JSON::LD
|
|
471
471
|
# @return [Object, Hash]
|
472
472
|
# If a block is given, the result of evaluating the block is returned, otherwise, the expanded JSON-LD document
|
473
473
|
def self.fromRdf(input, options = {}, &block)
|
474
|
-
options = {useNativeTypes: false}.merge(options)
|
474
|
+
options = {useNativeTypes: false}.merge!(options)
|
475
475
|
result = nil
|
476
476
|
|
477
477
|
API.new(nil, nil, options) do |api|
|
data/lib/json/ld/compact.rb
CHANGED
@@ -46,7 +46,7 @@ module JSON::LD
|
|
46
46
|
inside_reverse = property == '@reverse'
|
47
47
|
result = {}
|
48
48
|
|
49
|
-
element.
|
49
|
+
element.each_key do |expanded_property|
|
50
50
|
expanded_value = element[expanded_property]
|
51
51
|
debug("") {"#{expanded_property}: #{expanded_value.inspect}"}
|
52
52
|
|
data/lib/json/ld/context.rb
CHANGED
@@ -337,7 +337,7 @@ module JSON::LD
|
|
337
337
|
defined = {}
|
338
338
|
# For each key-value pair in context invoke the Create Term Definition subalgorithm, passing result for active context, context for local context, key, and defined
|
339
339
|
depth do
|
340
|
-
context.
|
340
|
+
context.each_key do |key|
|
341
341
|
result.create_term_definition(context, key, defined)
|
342
342
|
end
|
343
343
|
end
|
@@ -990,7 +990,7 @@ module JSON::LD
|
|
990
990
|
# @raise [RDF::ReaderError] if the iri cannot be expanded
|
991
991
|
# @see http://json-ld.org/spec/latest/json-ld-api/#value-expansion
|
992
992
|
def expand_value(property, value, options = {})
|
993
|
-
options = {useNativeTypes: false}.merge(options)
|
993
|
+
options = {useNativeTypes: false}.merge!(options)
|
994
994
|
depth(options) do
|
995
995
|
debug("expand_value") {"property: #{property.inspect}, value: #{value.inspect}"}
|
996
996
|
|
data/lib/json/ld/expand.rb
CHANGED
@@ -15,7 +15,7 @@ module JSON::LD
|
|
15
15
|
# Ensure output objects have keys ordered properly
|
16
16
|
# @return [Array, Hash]
|
17
17
|
def expand(input, active_property, context, options = {})
|
18
|
-
options = {ordered: true}.merge(options)
|
18
|
+
options = {ordered: true}.merge!(options)
|
19
19
|
debug("expand") {"input: #{input.inspect}, active_property: #{active_property.inspect}, context: #{context.inspect}"}
|
20
20
|
result = case input
|
21
21
|
when Array
|
data/lib/json/ld/resource.rb
CHANGED
data/lib/json/ld/utils.rb
CHANGED
@@ -9,7 +9,7 @@ module JSON::LD
|
|
9
9
|
# @return [Boolean]
|
10
10
|
def node?(value)
|
11
11
|
value.is_a?(Hash) &&
|
12
|
-
(value.
|
12
|
+
!(value.has_key?('@value') || value.has_key?('@list') || value.has_key?('@set')) &&
|
13
13
|
(value.length > 1 || !value.has_key?('@id'))
|
14
14
|
end
|
15
15
|
|
@@ -118,7 +118,7 @@ module JSON::LD
|
|
118
118
|
# true to allow duplicates, false not to (uses
|
119
119
|
# a simple shallow comparison of subject ID or value).
|
120
120
|
def add_value(subject, property, value, options = {})
|
121
|
-
options = {property_is_array: false, allow_duplicate: true}.merge(options)
|
121
|
+
options = {property_is_array: false, allow_duplicate: true}.merge!(options)
|
122
122
|
|
123
123
|
if value.is_a?(Array)
|
124
124
|
subject[property] = [] if value.empty? && options[:property_is_array]
|
@@ -211,14 +211,13 @@ module JSON::LD
|
|
211
211
|
# Add debug event to debug array, if specified
|
212
212
|
#
|
213
213
|
# param [String] message
|
214
|
-
# yieldreturn [String] appended to message, to allow for lazy-
|
214
|
+
# yieldreturn [String] appended to message, to allow for lazy-evaluation of message
|
215
215
|
def debug(*args)
|
216
|
-
options = args.last.is_a?(Hash) ? args.pop : {}
|
217
216
|
return unless ::JSON::LD.debug? || @options[:debug]
|
218
|
-
depth =
|
217
|
+
depth = @depth || 0
|
219
218
|
list = args
|
220
219
|
list << yield if block_given?
|
221
|
-
message = " " * depth * 2 +
|
220
|
+
message = " " * depth * 2 + list.join(": ")
|
222
221
|
case @options[:debug]
|
223
222
|
when Array
|
224
223
|
@options[:debug] << message
|
@@ -308,4 +307,4 @@ module JSON::LD
|
|
308
307
|
end
|
309
308
|
end
|
310
309
|
end
|
311
|
-
end
|
310
|
+
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: 1.1.
|
4
|
+
version: 1.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -371,7 +371,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
371
371
|
version: '0'
|
372
372
|
requirements: []
|
373
373
|
rubyforge_project: json-ld
|
374
|
-
rubygems_version: 2.4.
|
374
|
+
rubygems_version: 2.4.7
|
375
375
|
signing_key:
|
376
376
|
specification_version: 4
|
377
377
|
summary: JSON-LD reader/writer for Ruby.
|