Class: Parslet::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/parslet/scope.rb

Defined Under Namespace

Classes: Binding, NotFound

Instance Method Summary collapse

Constructor Details

#initializeScope

Returns a new instance of Scope.



32
33
34
# File 'lib/parslet/scope.rb', line 32

def initialize
  @current = Binding.new
end

Instance Method Details

#[](k) ⇒ Object



25
26
27
# File 'lib/parslet/scope.rb', line 25

def [](k)
  @current[k]
end

#[]=(k, v) ⇒ Object



28
29
30
# File 'lib/parslet/scope.rb', line 28

def []=(k,v)
  @current[k] = v
end

#popObject



39
40
41
# File 'lib/parslet/scope.rb', line 39

def pop
  @current = @current.parent
end

#pushObject



36
37
38
# File 'lib/parslet/scope.rb', line 36

def push
  @current = Binding.new(@current)
end