module Risitor::Visitor::ClassMethods
List of the methods extended by a Visitor
.
Public Instance Methods
add_visit_method(*types, &block)
click to toggle source
Add/override a visit method for the types types
.
# File lib/risitor/visitor.rb, line 39 def add_visit_method(*types, &block) block = block.curry(1) if block.arity.zero? types.each do |type| specialized_add_visit_method(type, &block) end end
Also aliased as: when_visiting
alias_visit_method(visit_method_alias)
click to toggle source
Alias the `visit` method.
# File lib/risitor/visitor.rb, line 34 def alias_visit_method(visit_method_alias) specialized_alias_visit_method(visit_method_alias) end
remove_visit_method(*types)
click to toggle source
Remove the visit methods for the types types
.
# File lib/risitor/visitor.rb, line 47 def remove_visit_method(*types) types.each do |type| specialized_remove_visit_method(type) end end
reset_visit_methods()
click to toggle source
Remove all the visit methods.
# File lib/risitor/visitor.rb, line 54 def reset_visit_methods visit_methods.each do |visit_method| specialized_remove_method(visit_method) end end
visit_methods()
click to toggle source
Return a list of the visit method.
# File lib/risitor/visitor.rb, line 61 def visit_methods return methods.select do |method| VisitMethodHelper.match(method) end end
visitable_types()
click to toggle source
Return a list of the types with a visit method.
# File lib/risitor/visitor.rb, line 68 def visitable_types return visit_methods.collect do |visit_method| VisitMethodHelper.get_type(visit_method) end end