Class: RubyTransform::Transformer
- Inherits:
-
Object
- Object
- RubyTransform::Transformer
- Includes:
- TransformerHelpers
- Defined in:
- lib/ruby_transform/transformer.rb
Overview
Takes a raw S-expression and transforms it (replaces the node with the return value of the process method). This is meant to be subclassed, and in the process method you should either return a transformed version of the node, or just call super which will leave the node in place and iterate through the children.
Direct Known Subclasses
RubyTransform::Transformers::BlockMethodToProcifier, RubyTransform::Transformers::ClearExplicitReturns, RubyTransform::Transformers::Composite, RubyTransform::Transformers::Custom, RubyTransform::Transformers::Eachifier, RubyTransform::Transformers::SymbolNames, RubyTransform::Transformers::Tapifier
Instance Method Summary collapse
Methods included from TransformerHelpers
Instance Method Details
#transform(sexp) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/ruby_transform/transformer.rb', line 12 def transform(sexp) if sexp.is_a?(Sexp) Sexp.new(*([sexp.kind] + sexp.body.map {|c| transform(c) })) else sexp end end |