Class: Parser::StaticEnvironment
- Inherits:
-
Object
- Object
- Parser::StaticEnvironment
- Defined in:
- lib/parser/static_environment.rb
Instance Method Summary collapse
- #declare(name) ⇒ Object
- #declared?(name) ⇒ Boolean
- #extend_dynamic ⇒ Object
- #extend_static ⇒ Object
-
#initialize ⇒ StaticEnvironment
constructor
A new instance of StaticEnvironment.
- #reset ⇒ Object
- #unextend ⇒ Object
Constructor Details
#initialize ⇒ StaticEnvironment
Returns a new instance of StaticEnvironment.
4 5 6 |
# File 'lib/parser/static_environment.rb', line 4 def initialize reset end |
Instance Method Details
#declare(name) ⇒ Object
33 34 35 36 37 |
# File 'lib/parser/static_environment.rb', line 33 def declare(name) @variables.add(name.to_sym) self end |
#declared?(name) ⇒ Boolean
39 40 41 |
# File 'lib/parser/static_environment.rb', line 39 def declared?(name) @variables.include?(name.to_sym) end |
#extend_dynamic ⇒ Object
20 21 22 23 24 25 |
# File 'lib/parser/static_environment.rb', line 20 def extend_dynamic @stack.push(@variables) @variables = @variables.dup self end |
#extend_static ⇒ Object
13 14 15 16 17 18 |
# File 'lib/parser/static_environment.rb', line 13 def extend_static @stack.push(@variables) @variables = Set[] self end |
#reset ⇒ Object
8 9 10 11 |
# File 'lib/parser/static_environment.rb', line 8 def reset @variables = Set[] @stack = [] end |
#unextend ⇒ Object
27 28 29 30 31 |
# File 'lib/parser/static_environment.rb', line 27 def unextend @variables = @stack.pop self end |