lib/json/ld/compact.rb in json-ld-1.0.1.1 vs lib/json/ld/compact.rb in json-ld-1.0.3
- old
+ new
@@ -65,10 +65,11 @@
if expanded_property == '@reverse'
compacted_value = depth {compact(expanded_value, '@reverse')}
debug("@reverse") {"compacted_value: #{compacted_value.inspect}"}
compacted_value.each do |prop, value|
if context.reverse?(prop)
- value = [value] unless value.is_a?(Array) || @options[:compactArrays]
+ value = [value] if !value.is_a?(Array) &&
+ (context.container(prop) == '@set' || !@options[:compactArrays])
debug("") {"merge #{prop} => #{value.inspect}"}
merge_compacted_value(result, prop, value)
compacted_value.delete(prop)
end
end