lib/json/ld/compact.rb in json-ld-3.1.7 vs lib/json/ld/compact.rb in json-ld-3.1.8

- old
+ new

@@ -62,11 +62,11 @@ self.context = context.parse(td.context, override_protected: true) log_debug("prop-scoped", depth: log_depth.to_i) {"context: #{self.context.inspect}"} end - if element.key?('@id') || element.key?('@value') + if (element.key?('@id') || element.key?('@value')) && !element.key?('@annotation') result = context.compact_value(property, element, base: @options[:base]) if !result.is_a?(Hash) || context.coerce(property) == '@json' log_debug("", depth: log_depth.to_i) {"=> scalar result: #{result.inspect}"} return result end @@ -229,11 +229,11 @@ if list?(expanded_item) compacted_item = as_array(compacted_item) unless container.include?('@list') al = context.compact_iri('@list', vocab: true) compacted_item = {al => compacted_item} - if expanded_item.has_key?('@index') + if expanded_item.key?('@index') key = context.compact_iri('@index', vocab: true) compacted_item[key] = expanded_item['@index'] end else add_value(nest_result, item_active_property, compacted_item, @@ -274,10 +274,10 @@ compacted_item = {al => compacted_item} if expanded_item['@id'] al = context.compact_iri('@id', vocab: true) compacted_item[al] = context.compact_iri(expanded_item['@id'], vocab: false) end - if expanded_item.has_key?('@index') + if expanded_item.key?('@index') key = context.compact_iri('@index', vocab: true) compacted_item[key] = expanded_item['@index'] end add_value(nest_result, item_active_property, compacted_item, property_is_array: as_array)