Class: Unparser::AST::Enumerator
- Inherits:
-
Object
- Object
- Unparser::AST::Enumerator
- Includes:
- Enumerable, Unparser::Adamantium
- Defined in:
- lib/unparser/ast.rb
Overview
AST enumerator
Class Method Summary collapse
-
.new(node, controller = TAUTOLOGY) ⇒ Enumerator
private
Return new instance.
Instance Method Summary collapse
-
#each(&block) ⇒ Enumerator<Parser::AST::Node>, self
private
Return each node.
-
#type(type) ⇒ Enumerable<Parser::AST::Node>
private
Return nodes selected by type.
-
#types(types) ⇒ Enumerable<Parser::AST::Node>
private
Return nodes selected by types.
Class Method Details
.new(node, controller = TAUTOLOGY) ⇒ Enumerator
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.
Return new instance
92 93 94 |
# File 'lib/unparser/ast.rb', line 92 def self.new(node, controller = TAUTOLOGY) super end |
Instance Method Details
#each(&block) ⇒ Enumerator<Parser::AST::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.
Return each node
106 107 108 |
# File 'lib/unparser/ast.rb', line 106 def each(&block) Walker.call(node, controller, &block) end |
#type(type) ⇒ Enumerable<Parser::AST::Node>
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.
Return nodes selected by type
130 131 132 |
# File 'lib/unparser/ast.rb', line 130 def type(type) select { |node| node.type.equal?(type) } end |
#types(types) ⇒ Enumerable<Parser::AST::Node>
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.
Return nodes selected by types
118 119 120 |
# File 'lib/unparser/ast.rb', line 118 def types(types) select { |node| types.include?(node.type) } end |