Class: DSLParser

Inherits:
Object
  • Object
show all
Defined in:
lib/dbexpect/d_s_l_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSLParser

Returns a new instance of DSLParser.



24
25
26
27
28
29
# File 'lib/dbexpect/d_s_l_parser.rb', line 24

def initialize
  @tables = {}
  @tree_nodes = [ExpectationTreeNode.new('->')]
  @files_loaded = Set.new
  @commands = []
end

Instance Attribute Details

#commandsObject

Returns the value of attribute commands.



22
23
24
# File 'lib/dbexpect/d_s_l_parser.rb', line 22

def commands
  @commands
end

Instance Method Details

#expectation_treeObject



31
32
33
# File 'lib/dbexpect/d_s_l_parser.rb', line 31

def expectation_tree
  @tree_nodes.first
end

#parse(script) ⇒ Object



35
36
37
# File 'lib/dbexpect/d_s_l_parser.rb', line 35

def parse(script)
  instance_eval(script)
end

#tablesObject



39
40
41
# File 'lib/dbexpect/d_s_l_parser.rb', line 39

def tables
  @tables.values
end