Class: SQL::Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/abstract-sql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAbstract

Returns a new instance of Abstract.



10
11
12
13
# File 'lib/abstract-sql.rb', line 10

def initialize
  @parser = Parser::Statement.new
  @transformer = Transform::Statement.new
end

Instance Attribute Details

#parserObject (readonly)

Returns the value of attribute parser.



8
9
10
# File 'lib/abstract-sql.rb', line 8

def parser
  @parser
end

#transformerObject (readonly)

Returns the value of attribute transformer.



8
9
10
# File 'lib/abstract-sql.rb', line 8

def transformer
  @transformer
end

Instance Method Details

#parse(sql) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/abstract-sql.rb', line 15

def parse(sql)
  tree = @parser.parse(sql)
  while tree != (t = @transformer.apply(tree) )
    tree = t
  end
  t
end