class Seaquel::Generator

Public Class Methods

new(ast) click to toggle source
# File lib/seaquel/generator.rb, line 8
def initialize ast
  @ast = ast
end

Public Instance Methods

compact_sql() click to toggle source
# File lib/seaquel/generator.rb, line 12
def compact_sql
  quoter = Quoter.new
 
  # Construct a statement
  expression_converter = ExpressionConverter.new(quoter)
  statement = Statement.new(expression_converter)

  # And a visitor for the AST
  visitor = StatementGatherer.new(statement, quoter)

  # Gather statement details from the AST
  @ast.visit(visitor)

  # Turn the statement into SQL.
  statement.to_s(:compact)
end