Class: ASTTransform::AbstractTransformation

Inherits:
Parser::AST::Processor
  • Object
show all
Includes:
TransformationHelper
Defined in:
lib/ast_transform/abstract_transformation.rb

Direct Known Subclasses

Transformation

Instance Method Summary collapse

Methods included from TransformationHelper

included

Instance Method Details

#process(node) ⇒ Object

Used internally by Parser::AST::Processor to process each node. DO NOT OVERRIDE.



19
20
21
22
23
# File 'lib/ast_transform/abstract_transformation.rb', line 19

def process(node)
  return node unless node.is_a?(Parser::AST::Node)

  process_node(node)
end

#run(node) ⇒ Parser::AST::Node

Runs this transformation on node. Note: If you want to add one-time checks to the transformation, override this, then call super.

Parameters:

  • node (Parser::AST::Node)

    The node to be transformed.

Returns:

  • (Parser::AST::Node)

    The transformed node.



14
15
16
# File 'lib/ast_transform/abstract_transformation.rb', line 14

def run(node)
  process(node)
end