Class: SqlTools::Predicate::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/sql_tools/predicate.rb

Instance Method Summary collapse

Constructor Details

#initialize(query) ⇒ Builder

Returns a new instance of Builder.



9
10
11
# File 'lib/sql_tools/predicate.rb', line 9

def initialize(query)
  @query = query
end

Instance Method Details

#build(predicate) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/sql_tools/predicate.rb', line 13

def build(predicate)
  case predicate
  when Predicate::Binary
    predicate.left = build(predicate.left)
    predicate.right = build(predicate.right)
    predicate
  when TreeStand::Node
    type_from_node(predicate)
  else
    raise "Unknown predicate: #{predicate}"
  end
end