Class: Hexp::Node::Rewriter
- Inherits:
-
Object
- Object
- Hexp::Node::Rewriter
- Includes:
- Hexp
- Defined in:
- lib/hexp/node/rewriter.rb
Overview
Create a new Hexp node based on an existing node
Rewriting in this case means iterating over the whole Hexp tree, and for each element providing zero or more elements to replace it with.
Constant Summary
Constant Summary
Constants included from Hexp
Instance Method Summary (collapse)
-
- (Rewriter) initialize(node, block)
constructor
A new instance of Rewriter.
- - (Object) to_hexp
Methods included from Hexp
Array, build, deep_freeze, included, parse
Constructor Details
- (Rewriter) initialize(node, block)
A new instance of Rewriter
11 12 13 |
# File 'lib/hexp/node/rewriter.rb', line 11 def initialize(node, block) @node, @block = node, block end |
Instance Method Details
- (Object) to_hexp
15 16 17 18 19 20 21 |
# File 'lib/hexp/node/rewriter.rb', line 15 def to_hexp @hexp ||= H[ @node.tag, @node.attributes, @block ? rewrite_children : @node.children ] end |