Class: Crokus::Ast

Inherits:
Object
  • Object
show all
Defined in:
lib/crokus/ast.rb

Instance Method Summary collapse

Instance Method Details

#accept(visitor, arg = nil) ⇒ Object



5
6
7
8
# File 'lib/crokus/ast.rb', line 5

def accept(visitor, arg=nil)
  name = self.class.name.split(/::/)[1]
  visitor.send("visit#{name}".to_sym, self ,arg) # Metaprograming !
end

#strObject



10
11
12
13
# File 'lib/crokus/ast.rb', line 10

def str
  ppr=PrettyPrinter.new
  self.accept(ppr)
end