Skip to content

Instantly share code, notes, and snippets.

@adomokos
adomokos / visitor_pattern_example.rb
Created May 24, 2011 17:28
The Visitor Pattern implementation in Ruby from the Wikipedia example
class CarElement
def accept(visitor)
raise NotImpelementedError.new
end
end
module Visitable
def accept(visitor)
visitor.visit(self)
end