Class: RSpock::AST::HeaderNodesTransformation
- Inherits:
-
ASTTransform::AbstractTransformation
- Object
- ASTTransform::AbstractTransformation
- RSpock::AST::HeaderNodesTransformation
- Defined in:
- lib/rspock/ast/header_nodes_transformation.rb
Instance Method Summary collapse
-
#initialize(header) ⇒ HeaderNodesTransformation
constructor
A new instance of HeaderNodesTransformation.
- #on_send(node) ⇒ Object
- #run(node) ⇒ Object
Constructor Details
#initialize(header) ⇒ HeaderNodesTransformation
Returns a new instance of HeaderNodesTransformation.
7 8 9 |
# File 'lib/rspock/ast/header_nodes_transformation.rb', line 7 def initialize(header) @header = header end |
Instance Method Details
#on_send(node) ⇒ Object
17 18 19 20 21 |
# File 'lib/rspock/ast/header_nodes_transformation.rb', line 17 def on_send(node) return super unless header_node?(node) node.updated(:lvar, [node.children[1]]) end |
#run(node) ⇒ Object
11 12 13 14 15 |
# File 'lib/rspock/ast/header_nodes_transformation.rb', line 11 def run(node) return node if @header.nil? || @header.empty? super end |