Sha256: afe4b36fcbe99dfd65b673d1b61fa2e136858a0b647615f6eee0dc2734a10deb
Contents?: true
Size: 691 Bytes
Versions: 9
Compression:
Stored size: 691 Bytes
Contents
# Define range filter rule # module QueryFilter::Rules class Range < Scope def initialize(keys, options = {}) @key = Array(keys).first @keys = [key_from, key_to] @options = options end def name 'range'.freeze end def valid?(values) filter = build_range_from_params(values) filter.valid? end def normalize_params(values) build_range_from_params(values) end protected def build_range_from_params(params) QueryFilter::Utils::ScopeRange.new(key, params) end def key_from @key_from ||= "#{key}_from".to_sym end def key_to @key_to ||= "#{key}_to".to_sym end end end
Version data entries
9 entries across 9 versions & 1 rubygems