app/services/blacklight/field_retriever.rb in blacklight-7.40.0 vs app/services/blacklight/field_retriever.rb in blacklight-8.0.0.beta1
- old
+ new
@@ -20,23 +20,21 @@
delegate :field, to: :field_config
# @return [Array]
def fetch
- if field_config.highlight
- value = retrieve_highlight
- end
- if value.blank?
- value = if field_config.accessor
- retieve_using_accessor
- elsif field_config.values
- retrieve_values
- else
- retrieve_simple
- end
- end
- Array.wrap(value)
+ Array.wrap(
+ if field_config.highlight
+ retrieve_highlight
+ elsif field_config.accessor
+ retieve_using_accessor
+ elsif field_config.values
+ retrieve_values
+ else
+ retrieve_simple
+ end
+ )
end
private
def retrieve_simple
@@ -67,16 +65,9 @@
# retrieve the document value from the highlighting response
document.highlight_field(field_config.field).map(&:html_safe) if document.has_highlight_field? field_config.field
end
def retrieve_values
- values_method = field_config.values
-
- if values_method.respond_to?(:arity) && values_method.arity.abs == 2
- Deprecation.warn(self, ":values parameter for field #{field_config.key} only accepts 2 arguments; should accept 3")
- values_method.call(field_config, document)
- else
- values_method.call(field_config, document, view_context)
- end
+ field_config.values.call(field_config, document, view_context)
end
end
end