D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Prism
/
Visitor
/
Filename :
cdesc-Visitor.ri
back
Copy
U:RDoc::NormalClass[iI"Visitor:ETI"Prism::Visitor;TI"Prism::BasicVisitor;To:RDoc::Markup::Document:@parts[o;;[ o:RDoc::Markup::Paragraph;[ I"RA visitor is a class that provides a default implementation for every accept ;TI"Lmethod defined on the nodes. This means it can walk a tree without the ;TI"Pcaller needing to define any special handling. This allows you to handle a ;TI"<subset of the tree, while still walking the whole tree.;To:RDoc::Markup::BlankLine o; ;[I"RFor example, to find all of the method calls that call the `foo` method, you ;TI"could write:;T@o:RDoc::Markup::Verbatim;[I"%class FooCalls < Prism::Visitor ;TI"! def visit_call_node(node) ;TI" if node.name == "foo" ;TI"( # Do something with the node ;TI" end ;TI" ;TI"E # Call super so that the visitor continues walking the tree ;TI" super ;TI" end ;TI"end;T:@format0: @fileI"lib/prism/visitor.rb;T:0@omit_headings_from_table_of_contents_below0; 0;0[ [ [ [[I" class;T[[:public[ [:protected[ [:private[ [I" instance;T[[;[ [;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0;0[@%I" Prism;TcRDoc::NormalModule