Class: Visitor
- Inherits:
-
Object
- Object
- Visitor
- Defined in:
- lib/loxby/visitors/base.rb
Overview
Base visitor class for visitor pattern. See Visitable.
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.define_types(base_type, subtypes) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/loxby/visitors/base.rb', line 19 def self.define_types(base_type, subtypes) subtypes.each do |subtype| method_name = "visit_#{subtype}_#{base_type}" define_method(method_name.to_sym) do |_| raise NotImplementedError, "#{self.class} has not implemented ##{method_name}" end end end |