Class: Veritas::SQL::Generator::Visitor
- Inherits:
-
Object
- Object
- Veritas::SQL::Generator::Visitor
- Defined in:
- lib/veritas/sql/generator/visitor.rb
Overview
Visit each node in a veritas AST and execute an associated method
Direct Known Subclasses
Defined Under Namespace
Classes: UnknownObject
Constant Summary collapse
- NAME_SEP_REGEXP =
/([a-z])([A-Z])/.freeze
- NAME_REP =
'\1_\2'.freeze
- DOUBLE_COLON =
'::'.freeze
- UNDERSCORE =
'_'.freeze
Class Method Summary collapse
-
.handler_for(visitable_class) ⇒ #to_sym
private
Lookup the handler method for a visitable class.
Instance Method Summary collapse
-
#visit(visitable) ⇒ self
Visit an object and generate SQL from each node.
-
#visited? ⇒ Boolean
Test if a visitable object has been visited.
Class Method Details
.handler_for(visitable_class) ⇒ #to_sym
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Lookup the handler method for a visitable class
28 29 30 |
# File 'lib/veritas/sql/generator/visitor.rb', line 28 def self.handler_for(visitable_class) handlers[visitable_class] or raise UnknownObject, "No handler for #{visitable_class} in #{self}" end |
Instance Method Details
#visit(visitable) ⇒ self
Visit an object and generate SQL from each node
86 87 88 |
# File 'lib/veritas/sql/generator/visitor.rb', line 86 def visit(visitable) raise NotImplementedError, "#{self.class}#visit must be implemented" end |
#visited? ⇒ Boolean
Test if a visitable object has been visited
98 99 100 |
# File 'lib/veritas/sql/generator/visitor.rb', line 98 def visited? raise NotImplementedError, "#{self.class}#visited? must be implemented" end |