Skip to content

Commit bb1c4c2

Browse files
committed
Replace mapping -= %w('@set') with more efficient mapping.delete('@set')
1 parent 046f97d commit bb1c4c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/json/ld/context.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def initialize(term,
113113
def container_mapping=(mapping)
114114
mapping = Array(mapping)
115115
if @as_set = mapping.include?('@set')
116-
mapping -= %w(@set)
116+
mapping.delete('@set')
117117
end
118118
@container_mapping = mapping.first
119119
end
@@ -1615,7 +1615,7 @@ def check_container(container, local_context, defined, term)
16151615
end
16161616

16171617
val = Array(container)
1618-
val -= %w(@set) if has_set = val.include?('@set')
1618+
val.delete('@set') if has_set = val.include?('@set')
16191619

16201620
raise JsonLdError::InvalidContainerMapping,
16211621
"'@container' has more than one value other than @set" if val.length > 1

0 commit comments

Comments
 (0)