module Risitor::VisitMethodHelper

Helper for visit methods generation, matching & co.

Constants

REGEXP
TEMPLATE

Public Class Methods

gen_name(type) click to toggle source

Return a visit method name for the type type.

# File lib/risitor/visit_method_helper.rb, line 8
def self.gen_name(type)
  return TEMPLATE % type.name
end
get_type(visit_method) click to toggle source

Return the type matching a visit method.

# File lib/risitor/visit_method_helper.rb, line 19
def self.get_type(visit_method)
  type_symbol = match(visit_method).captures[0]
  return const_get(type_symbol)
end
match(visit_method_name) click to toggle source

Return true if the visit_method_name is a well formed visit method name, else false.

# File lib/risitor/visit_method_helper.rb, line 14
def self.match(visit_method_name)
  return REGEXP.match(visit_method_name)
end