Class: DaedalSL::NestedBoolQuery

Inherits:
BlockQuery show all
Defined in:
lib/daedal-sl/nested_bool_query.rb

Instance Attribute Summary

Attributes inherited from BlockQuery

#base, #parent

Instance Method Summary collapse

Methods inherited from BlockQuery

build, #method_missing

Constructor Details

#initialize(parent, options) ⇒ NestedBoolQuery

Returns a new instance of NestedBoolQuery.



4
5
6
7
# File 'lib/daedal-sl/nested_bool_query.rb', line 4

def initialize(parent, options)
  @parent = parent
  @base = Daedal::Queries::NestedQuery.new(options.merge(query: Daedal::Queries::BoolQuery.new))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class DaedalSL::BlockQuery

Instance Method Details

#mustObject



9
10
11
12
13
# File 'lib/daedal-sl/nested_bool_query.rb', line 9

def must
  if (result = yield)
    @base.query.must << result
  end
end

#must_notObject



21
22
23
24
25
# File 'lib/daedal-sl/nested_bool_query.rb', line 21

def must_not
  if (result = yield)
    @base.query.must_not << result
  end
end

#shouldObject



15
16
17
18
19
# File 'lib/daedal-sl/nested_bool_query.rb', line 15

def should
  if (result = yield)
    @base.query.should << result
  end
end