Class: Boolminot::Clauses::Compounds::Conjunction

Inherits:
Logica::Predicates::Compounds::Conjunction
  • Object
show all
Extended by:
Base::ClassMethods, Base::ClassMethods
Includes:
Base::InstanceMethods, Base::InstanceMethods
Defined in:
lib/boolminot/clauses/compounds/conjunction.rb

Instance Method Summary collapse

Methods included from Base::ClassMethods

predicate_factory

Methods included from Base::InstanceMethods

#clauses, #to_raw_bool

Methods included from Base::InstanceMethods

#satisfied_by?, #to_elasticsearch_negated, #to_raw_bool

Instance Method Details

#to_elasticsearch(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/boolminot/clauses/compounds/conjunction.rb', line 11

def to_elasticsearch(options = {})
  bool = clauses.reduce({}) do |sections, clause|
    more_sections = clause.to_raw_bool(options.merge(added_to: sections)).fetch(:bool)
    sections.merge(more_sections) do |_, old_val, new_val|
      old_val + new_val
    end
  end

  { bool: bool }
end