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.
234 235 236 237 238 |
# File 'lib/tire/search/query.rb', line 234 def initialize(={}, &block) = @value = {} block.arity < 1 ? self.instance_eval(&block) : block.call(self) if block_given? end |
Instance Method Details
#query(&block) ⇒ Object
240 241 242 243 |
# File 'lib/tire/search/query.rb', line 240 def query(&block) @value[:query] = Query.new(&block).to_hash @value end |
#to_hash ⇒ Object
245 246 247 |
# File 'lib/tire/search/query.rb', line 245 def to_hash @value.update() end |
#to_json ⇒ Object
249 250 251 |
# File 'lib/tire/search/query.rb', line 249 def to_json to_hash.to_json end |