Skip to content

Commit 1c8ba9b

Browse files
committed
Fix bug where container could be returned as an Array and not a Set.
1 parent 9cd6010 commit 1c8ba9b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/json/ld/compact.rb

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ def compact(element,
212212
end
213213

214214
container = context.container(item_active_property)
215+
require 'byebug'; byebug if container && !container.is_a?(Set)
215216
as_array = !@options[:compactArrays] || context.as_array?(item_active_property)
216217

217218
value = case

lib/json/ld/context.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ def find_definition(term)
10381038
# @param [Term, #to_s] term in unexpanded form
10391039
# @return [Array<'@index', '@language', '@index', '@set', '@type', '@id', '@graph'>]
10401040
def container(term)
1041-
return [term] if term == '@list'
1041+
return Set[term] if term == '@list'
10421042
term = find_definition(term)
10431043
term ? term.container_mapping : Set.new
10441044
end

0 commit comments

Comments
 (0)