Class: Elasticquery::Filters::Term
- Inherits:
-
Base
- Object
- Base
- Elasticquery::Filters::Term
show all
- Defined in:
- lib/elasticquery/filters/term.rb
Constant Summary
collapse
- OPTIONS =
i(_cache)
Instance Method Summary
collapse
Methods inherited from Base
#dup_with, #invalid?, #to_not_hash
Constructor Details
#initialize(data = {}) ⇒ Term
8
9
10
11
|
# File 'lib/elasticquery/filters/term.rb', line 8
def initialize(data = {})
@options = data.slice *OPTIONS
@condition = data.except *OPTIONS
end
|
Instance Method Details
#to_hash ⇒ Object
17
18
19
|
# File 'lib/elasticquery/filters/term.rb', line 17
def to_hash
{term: @condition.merge(@options)}
end
|
#valid? ⇒ Boolean
13
14
15
|
# File 'lib/elasticquery/filters/term.rb', line 13
def valid?
@condition.keys.size == 1 && @condition.values[0].present?
end
|