Class: Unparser::AST::Walker
- Inherits:
-
Object
- Object
- Unparser::AST::Walker
- Defined in:
- lib/unparser/ast.rb
Overview
Controlled AST walker walking the AST in deeth first search with pre order
Class Method Summary collapse
-
.call(node, controller = TAUTOLOGY, &block) ⇒ self
private
Call ast walker.
Instance Method Summary collapse
-
#call(node) ⇒ self
private
Call walker with node.
Class Method Details
.call(node, controller = TAUTOLOGY, &block) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call ast walker
171 172 173 174 |
# File 'lib/unparser/ast.rb', line 171 def self.call(node, controller = TAUTOLOGY, &block) new(block, controller).call(node) self end |
Instance Method Details
#call(node) ⇒ self
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call walker with node
184 185 186 187 188 189 190 191 192 |
# File 'lib/unparser/ast.rb', line 184 def call(node) return unless controller.call(node) block.call(node) node.children.each do |child| next unless child.is_a?(Parser::AST::Node) call(child) end self end |