module Eavi::Visitor::MethodsWhenIncludedAndExtended

Extends if included or extended

Public Instance Methods

add_visit_method(*types, &block) click to toggle source

Add/override a visit method for the types types.

# File lib/eavi/visitor.rb, line 63
def add_visit_method(*types, &block)
  if block.arity.zero?
    original_block = block
    block = proc { |_| instance_exec(&original_block) }
  end
  types.each do |type|
    specialized_add_visit_method(type, block)
  end
end
alias_visit_method(visit_method_alias) click to toggle source

Alias the `visit` method.

# File lib/eavi/visitor.rb, line 58
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/eavi/visitor.rb, line 74
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/eavi/visitor.rb, line 81
def reset_visit_methods
  visit_methods.each do |visit_method|
    specialized_remove_method(visit_method)
  end
end
visit_methods() click to toggle source

Returns a list of the visit method.

# File lib/eavi/visitor.rb, line 88
def visit_methods
  specialized_visit_methods
end
visitable_types() click to toggle source

Returns a list of the types with a visit method.

# File lib/eavi/visitor.rb, line 93
def visitable_types
  return visit_methods.collect do |visit_method|
    VisitMethodHelper.get_type(visit_method)
  end
end