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



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

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)


131
132
133
134
# File 'lib/unparser/ast/local_variable_scope.rb', line 131

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



146
147
148
149
# File 'lib/unparser/ast/local_variable_scope.rb', line 146

def each(node, &block)
  return to_enum(__method__, node) unless block_given?
  visit(node, &block)
end