Sha256: bdd10a8ac35d8fa02689b77eecfa4ee9602557259e38ea5659ef752effa8112b

Contents?: true

Size: 399 Bytes

Versions: 33

Compression:

Stored size: 399 Bytes

Contents

# frozen_string_literal: true

module Parser

  class VariablesStack
    def initialize
      @stack = []
      push
    end

    def push
      @stack << Set.new
    end

    def pop
      @stack.pop
    end

    def reset
      @stack.clear
    end

    def declare(name)
      @stack.last << name.to_sym
    end

    def declared?(name)
      @stack.last.include?(name.to_sym)
    end
  end

end

Version data entries

33 entries across 30 versions & 6 rubygems

Version Path
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/parser-2.7.2.0/lib/parser/variables_stack.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/parser-2.7.2.0/lib/parser/variables_stack.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/parser-2.7.2.0/lib/parser/variables_stack.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/parser-2.7.2.0/lib/parser/variables_stack.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/parser-2.7.2.0/lib/parser/variables_stack.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/parser-2.7.2.0/lib/parser/variables_stack.rb
passbase-1.3.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
passbase-1.2.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
passbase-1.1.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
passbase-1.0.3 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
passbase-1.0.2 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
passbase-1.0.1 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
passbase-1.0.0 vendor/bundle/ruby/2.7.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
parser-2.7.2.0 lib/parser/variables_stack.rb
parser-2.7.1.5 lib/parser/variables_stack.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/parser-2.7.0.2/lib/parser/variables_stack.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/parser-2.7.1.4/lib/parser/variables_stack.rb
parser-2.7.1.4 lib/parser/variables_stack.rb
parser-2.7.1.3 lib/parser/variables_stack.rb