Method: BooleanTermParser::Query#initialize
- Defined in:
- lib/doing/boolean_term_parser.rb
#initialize(clauses) ⇒ Query
Returns a new instance of Query.
51 52 53 54 55 56 |
# File 'lib/doing/boolean_term_parser.rb', line 51 def initialize(clauses) grouped = clauses.chunk { |c| c.operator }.to_h self.should_terms = grouped.fetch(:should, []).map(&:term) self.must_not_terms = grouped.fetch(:must_not, []).map(&:term) self.must_terms = grouped.fetch(:must, []).map(&:term) end |