Method: SyntaxTree::BasicVisitor.visit_method

Defined in:
lib/syntax_tree/basic_visitor.rb

.visit_method(method_name) ⇒ Object

This method is here to help folks write visitors.

It’s not always easy to ensure you’re writing the correct method name in the visitor since it’s perfectly valid to define methods that don’t override these parent methods.

If you use this method, you can ensure you’re writing the correct method name. It will raise an error if the visit method you’re defining isn’t actually a method on the parent visitor.

Raises:



53
54
55
56
57
# File 'lib/syntax_tree/basic_visitor.rb', line 53

def visit_method(method_name)
  return if visit_methods.include?(method_name)

  raise VisitMethodError, method_name
end