Sha256: 4c340306accb905a2c163cb14418a92eb2b841955a963ed4661131e70aacc02e
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module Europeana module Blacklight class SearchBuilder ## # "Overlay" params do not replace others, but are combined with them, into # multiple values for those param keys module OverlayParams extend ActiveSupport::Concern included do default_processor_chain << :add_overlay_params_to_api end def with_overlay_params(overlay_params = {}) @overlay_params ||= [] @overlay_params << overlay_params self end def add_overlay_params_to_api(api_parameters) return unless @overlay_params @overlay_params.each do |param_set| param_set.each_pair do |k, v| k = k.to_sym api_parameters[k] = if api_parameters.key?(k) [api_parameters[k]].flatten # in case it's not an Array else [] end api_parameters[k] += [v] api_parameters[k] = api_parameters[k].flatten.uniq end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
europeana-blacklight-1.3.1 | lib/europeana/blacklight/search_builder/overlay_params.rb |
europeana-blacklight-1.3.0 | lib/europeana/blacklight/search_builder/overlay_params.rb |