app/models/spotlight/resources/iiif_manifest.rb in blacklight-spotlight-3.5.0.4 vs app/models/spotlight/resources/iiif_manifest.rb in blacklight-spotlight-3.6.0.beta1
- old
+ new
@@ -113,12 +113,12 @@
custom_field_keys.include?(key.downcase)
end
end
def exhibit_custom_fields
- @exhibit_custom_fields ||= exhibit.custom_fields.each_with_object({}) do |value, hash|
- hash[value.label] = value
+ @exhibit_custom_fields ||= exhibit.custom_fields.index_by do |value|
+ value.label
end
end
def image_urls
@image_urls ||= resources.map do |resource|
@@ -241,17 +241,17 @@
if value.none? { |v| v.is_a?(Hash) && v.key?('@language') }
value.map { |v| json_ld_value(v) }
# If any of the values have a language associated with them, the client must display all of the values associated with the language that best
# matches the language preference.
elsif value.any? { |v| v.is_a?(Hash) && v['@language'] == default_json_ld_language }
- value.select { |v| v.is_a?(Hash) && v['@language'] == default_json_ld_language }.map { |v| v['@value'] }
+ value.select { |v| v.is_a?(Hash) && v['@language'] == default_json_ld_language }.pluck('@value')
# If all of the values have a language associated with them, and none match the language preference, the client must select a language
# and display all of the values associated with that language.
elsif value.all? { |v| v.is_a?(Hash) && v.key?('@language') }
selected_json_ld_language = value.find { |v| v.is_a?(Hash) && v.key?('@language') }
value.select { |v| v.is_a?(Hash) && v['@language'] == selected_json_ld_language['@language'] }
- .map { |v| v['@value'] }
+ .pluck('@value')
# If some of the values have a language associated with them, but none match the language preference, the client must display all of the values
# that do not have a language associated with them.
else
value.select { |v| !v.is_a?(Hash) || !v.key?('@language') }.map { |v| json_ld_value(v) }
end