Module: Eavi::Visitor::DSL

Defined in:
lib/eavi/visitor.rb

Overview

DSL methods

Instance Method Summary collapse

Instance Method Details

#def_visit(*types, &block) ⇒ Object

DSL method to add visit methods on types types.

Parameters:

  • *types (Array<Class>)

    Types attached to the new visit method

  • block (Proc)

    The content of the visit method



43
44
45
# File 'lib/eavi/visitor.rb', line 43

def def_visit(*types, &block)
  add_visit_method(*types, &block)
end

#undef_visit(*types) ⇒ Object

DSL method to remove visit methods on types types.

Parameters:

  • *types (Array<Class>)

    Types attached to the removed visit method



50
51
52
# File 'lib/eavi/visitor.rb', line 50

def undef_visit(*types)
  remove_visit_method(*types)
end