Class: Unparser::AST::LocalVariableScopeEnumerator

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/unparser/ast/local_variable_scope.rb

Overview

Local variable scope enumerator

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeundefined

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.

Initialize object



93
94
95
# File 'lib/unparser/ast/local_variable_scope.rb', line 93

def initialize
  @stack = [Set.new]
end

Class Method Details

.each(node, &block) ⇒ 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.

Enumerate each node with its local variable scope

Parameters:

  • node (Parser::AST::Node)

Returns:

  • (self)


105
106
107
108
# File 'lib/unparser/ast/local_variable_scope.rb', line 105

def self.each(node, &block)
  new.each(node, &block)
  self
end

Instance Method Details

#each(node, &block) ⇒ self, Enumerator<Array<Symbol>>

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.

Enumerate local variable scope scope

Returns:

  • (self)

    if block given

  • (Enumerator<Array<Symbol>>)

    ] otherwise



120
121
122
# File 'lib/unparser/ast/local_variable_scope.rb', line 120

def each(node, &block)
  visit(node, &block)
end