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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e46360376bb00811dd36960ac15dae42a9d35ed
4
- data.tar.gz: db5cf509c8b10b010bb62a05713037eeafe1122c
3
+ metadata.gz: 5154c2b04be740ac97d8e01a44384578ed8aa872
4
+ data.tar.gz: d027b37fc1dbecf4bed0f14340c87147fb27640b
5
5
  SHA512:
6
- metadata.gz: a89eec30bedcf9e199f4bcb8aab8e9af134ab9f7fbfd1d97227c27553d356df057ed6fa9727a93d95aec7e5f85309c7db65a69aa8453f48b38c85e5544ee625c
7
- data.tar.gz: f0f408d42463f63f89f9aec2fb10370d2fbddfb4a7a221f825e12b953b076a31aa44d84e627cd4e337e60e4a313cddd4a35df57e87506e5fe0a53b55b22bd2cd
6
+ metadata.gz: 0205eee6e03bf7c1eae78d27b18288d07462447b468e5d95b74283d4532bf1b21a4494bc0be27f2e1c2f164cdd466b5eca944a61dd03cc8fd24f9100556ca757
7
+ data.tar.gz: 7e3c65b3576b716c65e00a79d4fa399e05cea9d01d9494283c2d61d2df04eef2caf21e8c8c5094f3f1879adf68fa29a7f6005269b40c442dceaaddac41ad5663
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.10
1
+ 1.1.11
@@ -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|
@@ -46,7 +46,7 @@ module JSON::LD
46
46
  inside_reverse = property == '@reverse'
47
47
  result = {}
48
48
 
49
- element.keys.each do |expanded_property|
49
+ element.each_key do |expanded_property|
50
50
  expanded_value = element[expanded_property]
51
51
  debug("") {"#{expanded_property}: #{expanded_value.inspect}"}
52
52
 
@@ -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.keys.each do |key|
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
 
@@ -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
@@ -174,7 +174,7 @@ module JSON::LD
174
174
  stub: true
175
175
  )
176
176
  else
177
- obj.keys.each do |k|
177
+ obj.each_key do |k|
178
178
  obj[k] = update_obj(obj[k], reference_map)
179
179
  end
180
180
  obj
@@ -9,7 +9,7 @@ module JSON::LD
9
9
  # @return [Boolean]
10
10
  def node?(value)
11
11
  value.is_a?(Hash) &&
12
- (value.keys & %w(@value @list @set)).empty? &&
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-evaulation of message
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 = options[:depth] || @depth || 0
217
+ depth = @depth || 0
219
218
  list = args
220
219
  list << yield if block_given?
221
- message = " " * depth * 2 + (list.empty? ? "" : list.join(": "))
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.10
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-09-22 00:00:00.000000000 Z
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.3
374
+ rubygems_version: 2.4.7
375
375
  signing_key:
376
376
  specification_version: 4
377
377
  summary: JSON-LD reader/writer for Ruby.