Class: QueryFilter::Rules::DateRange

Inherits:
Scope
  • Object
show all
Defined in:
lib/query_filter/rules/date_range.rb

Constant Summary

Constants inherited from Scope

Scope::VALIDATON_KEYS

Instance Attribute Summary

Attributes inherited from Scope

#keys

Instance Method Summary collapse

Methods inherited from Scope

#blank_validation?, #can_apply?, #endpoint, #initialize, #key

Constructor Details

This class inherits a constructor from QueryFilter::Rules::Scope

Instance Method Details

#nameObject



12
13
14
# File 'lib/query_filter/rules/date_range.rb', line 12

def name
  'date_range'
end

#normalize_params(values) ⇒ Object



21
22
23
# File 'lib/query_filter/rules/date_range.rb', line 21

def normalize_params(values)
  build_period_from_params(values)
end

#valid?(values) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/query_filter/rules/date_range.rb', line 16

def valid?(values)
  period = build_period_from_params(values)
  !(period.nil? || period.default?)
end