Module: ScopedSearch::QueryBuilder::AST::LogicalOperatorNode

Defined in:
lib/scoped_search/query_builder.rb

Overview

Defines the to_sql method for AST AND/OR operators

Instance Method Summary collapse

Instance Method Details

#to_sql(definition, &block) ⇒ Object



201
202
203
204
# File 'lib/scoped_search/query_builder.rb', line 201

def to_sql(definition, &block)
  fragments = children.map { |c| c.to_sql(definition, &block) }.compact
  fragments.empty? ? nil : "(#{fragments.join(" #{operator.to_s.upcase} ")})"
end