Class: Elos::QueryBuilder::Base
- Inherits:
-
Object
- Object
- Elos::QueryBuilder::Base
- Includes:
- Filters, Queries
- Defined in:
- lib/elos/query_builder/base.rb
Direct Known Subclasses
Elos::QueryBuilder::Builtin::MatchAllQueryBuilder, Elos::QueryBuilder::Builtin::WhereQueryBuilder
Instance Method Summary collapse
-
#initialize(params) ⇒ Base
constructor
A new instance of Base.
- #wrap_build ⇒ Object
Constructor Details
#initialize(params) ⇒ Base
Returns a new instance of Base.
5 6 7 8 |
# File 'lib/elos/query_builder/base.rb', line 5 def initialize(params) @klass = params.delete(:class) @params = params end |
Instance Method Details
#wrap_build ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/elos/query_builder/base.rb', line 10 def wrap_build query = build return query if !@klass.respond_to?(:physically_destroy?) || @klass.physically_destroy? original_query = query[:query] filter = term_filter(:_destroyed, value: false) query[:query] = { filtered: { query: original_query, filter: filter } } # puts JSON.pretty_generate(query) query end |