class VariableScopeStack
A stack of VariableScope
Public Class Methods
new()
click to toggle source
# File lib/rubocop/yast/variable_scope.rb, line 51 def initialize outer_scope = VariableScope.new @stack = [outer_scope] end
Public Instance Methods
innermost()
click to toggle source
The innermost, or current VariableScope
# File lib/rubocop/yast/variable_scope.rb, line 57 def innermost @stack.last end
with_copy(&block)
click to toggle source
Run block using a copy of the innermost scope @return the scope as the block left it, popped from the stack
# File lib/rubocop/yast/variable_scope.rb, line 72 def with_copy(&block) @stack.push innermost.dup block.call @stack.pop end
with_new(&block)
click to toggle source
Run block using a new clean scope @return the scope as the block left it, popped from the stack
# File lib/rubocop/yast/variable_scope.rb, line 63 def with_new(&block) @stack.push VariableScope.new RuboCop::Yast.logger.debug "SCOPES #{@stack.inspect}" block.call @stack.pop end