Skip to content

Commit 58f130d

Browse files
committedMay 10, 2022
When expanding, don't delete @context from input. Fixes #54.
1 parent 9fd51e0 commit 58f130d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/json/ld/expand.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def expand(input, active_property, context,
8888

8989
# If element contains the key @context, set active context to the result of the Context Processing algorithm, passing active context and the value of the @context key as local context.
9090
if input.key?('@context')
91-
context = context.parse(input.delete('@context'), base: @options[:base])
91+
context = context.parse(input['@context'], base: @options[:base])
9292
log_debug("expand", depth: log_depth.to_i) {"context: #{context.inspect}"}
9393
end
9494

@@ -99,7 +99,7 @@ def expand(input, active_property, context,
9999

100100
# See if keys mapping to @type have terms with a local context
101101
type_key = nil
102-
input.keys.sort.
102+
(input.keys - %w(@context)).sort.
103103
select {|k| context.expand_iri(k, vocab: true, base: @options[:base]) == '@type'}.
104104
each do |tk|
105105

0 commit comments

Comments
 (0)