Class: Unparser::AST::Enumerator
- Inherits:
-
Object
- Object
- Unparser::AST::Enumerator
- Includes:
- Adamantium::Flat, Enumerable
- 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
94 95 96 |
# File 'lib/unparser/ast.rb', line 94 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
108 109 110 |
# File 'lib/unparser/ast.rb', line 108 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
132 133 134 |
# File 'lib/unparser/ast.rb', line 132 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
120 121 122 |
# File 'lib/unparser/ast.rb', line 120 def types(types) select { |node| types.include?(node.type) } end |