lerVisitor def visit subject puts subject . value * 0 end end ast = Ast . new puts "Doubler:" ast . accept DoublerVisitor . new puts "Tripler:" ast . accept TriplerVisitor . new # => Doubler : 0 0 Tripler : 0 0  