Sha256: ccb3342b0d51fb74f905195e1794cd65faad336e806d08bf3127838923b2694a
Contents?: true
Size: 836 Bytes
Versions: 8
Compression:
Stored size: 836 Bytes
Contents
module FortyFacets class ScopeFilterDefinition < FilterDefinition class ScopeFilter < Filter def active? value == '1' end def build_scope return Proc.new { |base| base } unless active? Proc.new { |base| base.send(definition.path.first) } end def remove new_params = search_instance.params || {} new_params.delete(definition.request_param) search_instance.class.new_unwrapped(new_params, search_instance.root) end def add new_params = search_instance.params || {} new_params[definition.request_param] = '1' search_instance.class.new_unwrapped(new_params, search_instance.root) end end def build_filter(search_instance, value) ScopeFilter.new(self, search_instance, value) end end end
Version data entries
8 entries across 8 versions & 1 rubygems