Class: Tire::Search::NestedQuery
- Inherits:
-
Object
- Object
- Tire::Search::NestedQuery
- Defined in:
- lib/tire/search/query.rb
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ NestedQuery
constructor
A new instance of NestedQuery.
- #query(&block) ⇒ Object
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ NestedQuery
Returns a new instance of NestedQuery.
207 208 209 210 211 |
# File 'lib/tire/search/query.rb', line 207 def initialize(={}, &block) @options = @value = {} block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given? end |
Instance Method Details
#query(&block) ⇒ Object
213 214 215 216 |
# File 'lib/tire/search/query.rb', line 213 def query(&block) @value[:query] = Query.new(&block).to_hash @value end |
#to_hash ⇒ Object
218 219 220 |
# File 'lib/tire/search/query.rb', line 218 def to_hash @value.update(@options) end |
#to_json ⇒ Object
222 223 224 |
# File 'lib/tire/search/query.rb', line 222 def to_json to_hash.to_json end |