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
87 88 89 |
# File 'lib/unparser/ast.rb', line 87 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
101 102 103 104 |
# File 'lib/unparser/ast.rb', line 101 def each(&block) return to_enum unless block_given? 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
126 127 128 |
# File 'lib/unparser/ast.rb', line 126 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
114 115 116 |
# File 'lib/unparser/ast.rb', line 114 def types(types) select { |node| types.include?(node.type) } end |