Class: Seaquel::Generator
- Inherits:
-
Object
- Object
- Seaquel::Generator
- Defined in:
- lib/seaquel/generator.rb
Instance Method Summary collapse
- #compact_sql ⇒ Object
-
#initialize(ast) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(ast) ⇒ Generator
Returns a new instance of Generator.
8 9 10 |
# File 'lib/seaquel/generator.rb', line 8 def initialize ast @ast = ast end |
Instance Method Details
#compact_sql ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 |