Module: Visitable

Defined in:
lib/loxby/visitors/base.rb

Overview

Visitable adds ‘#accept`, the only method required to implement the visitor pattern on a class. To use the visitor pattern, `include Visitable` to your class and subclass `Visitor` to implement visitors.

Instance Method Summary collapse

Instance Method Details

#accept(visitor) ⇒ Object

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/loxby/visitors/base.rb', line 11

def accept(visitor)
  raise NotImplementedError, "#{self.class} has not implemented #accept"
end