Class: GitlabZOQL::Parser::Statement::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab-zoql/parser/statement.rb

Instance Method Summary collapse

Instance Method Details

#accept(visitor) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/gitlab-zoql/parser/statement.rb', line 5

def accept(visitor)
  klass = self.class.ancestors.find do |ancestor|
    visitor.respond_to?("visit_#{demodulize(ancestor.name)}")
  end

  raise "No visitor for #{self.class.name}" unless klass

  visitor.__send__("visit_#{demodulize(klass.name)}", self)
end

#to_sqlObject



15
16
17
# File 'lib/gitlab-zoql/parser/statement.rb', line 15

def to_sql
  GitlabZOQL::Visitor.new.visit(self)
end