Class: Spectre::Closure

Inherits:
Hash
  • Object
show all
Defined in:
lib/spectre/base/closure.rb

Overview

Provides a Closure over several semantic actions to allow them to interact with each other and temporarily store data. The default Closure is a simple hash, but actually it can be an arbitrary object, as long as it provides the Hash methods [] and []= and the attributes parser and node.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nodeObject

The Node this Closure belongs to.



39
40
41
# File 'lib/spectre/base/closure.rb', line 39

def node
  @node
end

#parserObject

The Parser this Closure belongs to.



35
36
37
# File 'lib/spectre/base/closure.rb', line 35

def parser
  @parser
end

Instance Method Details

#parentObject



41
42
43
# File 'lib/spectre/base/closure.rb', line 41

def parent
    @parser.parent.closure
end