app/services/blacklight/field_retriever.rb in blacklight-6.5.0 vs app/services/blacklight/field_retriever.rb in blacklight-6.6.0
- old
+ new
@@ -11,17 +11,16 @@
delegate :field, to: :field_config
# @return [Array]
def fetch
Array.wrap(
- case
- when field_config.highlight
- retrieve_highlight
- when field_config.accessor
- retieve_using_accessor
- when field_config
- retrieve_simple
+ if field_config.highlight
+ retrieve_highlight
+ elsif field_config.accessor
+ retieve_using_accessor
+ elsif field_config
+ retrieve_simple
end
)
end
private
@@ -35,13 +34,13 @@
end
end
def retieve_using_accessor
# implicit method call
- if field_config.accessor === true
+ if field_config.accessor == true
document.send(field)
# arity-1 method call (include the field name in the call)
- elsif !field_config.accessor.is_a?(Array) && document.method(field_config.accessor).arity != 0
+ elsif !field_config.accessor.is_a?(Array) && document.method(field_config.accessor).arity.nonzero?
document.send(field_config.accessor, field)
# chained method calls
else
Array(field_config.accessor).inject(document) do |result, method|
result.send(method)