Class: Qdsl::Boolean
- Inherits:
-
Expression
- Object
- Expression
- Qdsl::Boolean
- Defined in:
- lib/boolean.rb
Instance Method Summary collapse
-
#initialize(operator, exprs) ⇒ Boolean
constructor
A new instance of Boolean.
- #render_sql(context, ids) ⇒ Object
Methods inherited from Expression
Constructor Details
#initialize(operator, exprs) ⇒ Boolean
Returns a new instance of Boolean.
5 6 7 8 |
# File 'lib/boolean.rb', line 5 def initialize(operator, exprs) @operator = operator @exprs = exprs end |
Instance Method Details
#render_sql(context, ids) ⇒ Object
10 11 12 13 14 |
# File 'lib/boolean.rb', line 10 def render_sql(context, ids) expr_results = @exprs.collect { |x| render_operand(context, ids, x) } parameters = expr_results.inject({}) { |acc, x| acc.merge(x.parameters) } SimpleRenderResult.new(expr_results.collect { |x| "(#{x.sql})" }.join(" #{@operator} "), parameters) end |