Skip to content

Commit

Permalink
Record property-scoped contexts.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed May 26, 2019
1 parent 812d946 commit dbdcce6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/json/ld/context.rb
Expand Up @@ -248,6 +248,10 @@ def inspect
# @return [Context]
attr_accessor :previous_context

# Context is property-scoped
# @return [Boolean]
attr_accessor :property_scoped

# Default language
#
#
Expand Down Expand Up @@ -426,6 +430,7 @@ def parse(local_context, remote_contexts: [], from_property: false, from_type: f
result = self.dup
result.provided_context = local_context if self.empty?
result.previous_context ||= result.dup if from_type
result.property_scoped ||= from_property

local_context = as_array(local_context)

Expand All @@ -435,6 +440,7 @@ def parse(local_context, remote_contexts: [], from_property: false, from_type: f
# 3.1 If the `from_property` is not null, and the active context contains protected terms, an error is raised.
if from_property || result.term_definitions.values.none?(&:protected?)
null_context = Context.new(options)
null_context.property_scoped = from_property
null_context.previous_context = result if from_type
result = null_context
else
Expand Down

0 comments on commit dbdcce6

Please sign in to comment.