Class: Elasticquery::Filters::Range
- Defined in:
- lib/elasticquery/filters/range.rb
Constant Summary collapse
- OPTIONS =
i(_cache execution)
Instance Method Summary collapse
-
#initialize(field = nil, gte: nil, lte: nil, **options) ⇒ Range
constructor
A new instance of Range.
- #to_hash ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Base
#dup_with, #invalid?, #to_not_hash
Constructor Details
#initialize(field = nil, gte: nil, lte: nil, **options) ⇒ Range
Returns a new instance of Range.
8 9 10 11 |
# File 'lib/elasticquery/filters/range.rb', line 8 def initialize(field = nil, gte: nil, lte: nil, **) = .slice *OPTIONS @field, @gte, @lte = field, gte, lte end |
Instance Method Details
#to_hash ⇒ Object
17 18 19 |
# File 'lib/elasticquery/filters/range.rb', line 17 def to_hash {range: } end |
#valid? ⇒ Boolean
13 14 15 |
# File 'lib/elasticquery/filters/range.rb', line 13 def valid? @gte.present? || @lte.present? end |