Skip to content

Commit c156b10

Browse files
committed
Remove protected argument to context parsing (unused).
1 parent 3640703 commit c156b10

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lib/json/ld/context.rb

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ def inspect
336336
# @raise [JsonLdError]
337337
# on a remote context load error, syntax error, or a reference to a term which is not defined.
338338
# @return [Context]
339-
def self.parse(local_context, protected: nil, override_protected: false, propagate: true, **options)
340-
self.new(**options).parse(local_context, protected: protected, override_protected: override_protected, propagate: propagate)
339+
def self.parse(local_context, override_protected: false, propagate: true, **options)
340+
self.new(**options).parse(local_context, override_protected: override_protected, propagate: propagate)
341341
end
342342

343343
##
@@ -537,7 +537,6 @@ def propagate=(value, **options)
537537
#
538538
# @param [String, #read, Array, Hash, Context] local_context
539539
# @param [Array<String>] remote_contexts
540-
# @param [Boolean] protected Make defined terms protected (as if `@protected` were used).
541540
# @param [Boolean] override_protected Protected terms may be cleared.
542541
# @param [Boolean] propagate
543542
# If false, retains any previously defined term, which can be rolled back when the descending into a new node object changes.
@@ -550,7 +549,6 @@ def propagate=(value, **options)
550549
# @see https://www.w3.org/TR/json-ld11-api/index.html#context-processing-algorithm
551550
def parse(local_context,
552551
remote_contexts: [],
553-
protected: nil,
554552
override_protected: false,
555553
propagate: true,
556554
validate_scoped: true)
@@ -642,11 +640,6 @@ def parse(local_context,
642640
end
643641
end.dup()
644642

645-
# if `protected` is true, update term definitions to be protected
646-
if protected
647-
cached_context.term_definitions.each {|td| td.protected = true if td.protected.nil?}
648-
end
649-
650643
# Merge loaded context noting protected term overriding
651644
context = result.merge(cached_context, override_protected: override_protected)
652645

@@ -695,7 +688,7 @@ def parse(local_context,
695688
raise JsonLdError::LoadingRemoteContextFailed, "#{source}: #{e.message}", e.backtrace
696689
end
697690
else
698-
result.send(setter, context[key], remote_contexts: remote_contexts, protected: context.fetch('@protected', protected))
691+
result.send(setter, context[key], remote_contexts: remote_contexts)
699692
end
700693
context.delete(key)
701694
end
@@ -707,7 +700,7 @@ def parse(local_context,
707700
# ... where key is not @base, @vocab, @language, or @version
708701
result.create_term_definition(context, key, defined,
709702
override_protected: override_protected,
710-
protected: context.fetch('@protected', protected),
703+
protected: context['@protected'],
711704
remote_contexts: remote_contexts.dup,
712705
validate_scoped: validate_scoped
713706
) unless NON_TERMDEF_KEYS.include?(key)

0 commit comments

Comments
 (0)