Class: Yadriggy::ASTreeTable
- Inherits:
-
Object
- Object
- Yadriggy::ASTreeTable
- Defined in:
- lib/yadriggy/ast.rb
Overview
A table of reified abstract syntax trees. It is used for guaranteeing the uniqueness of ASTree objects.
Instance Attribute Summary collapse
-
#trees ⇒ Hash
readonly
All the elements.
Instance Method Summary collapse
-
#[](context) ⇒ Object
Gets the value associated with the key.
-
#[]=(context, ast) ⇒ Object
Records a key-value pair.
-
#delete(context) ⇒ Object
Deletes a key-value pair.
-
#each(&blk) ⇒ Object
Executes a block once for each element.
-
#initialize ⇒ ASTreeTable
constructor
A new instance of ASTreeTable.
Constructor Details
#initialize ⇒ ASTreeTable
Returns a new instance of ASTreeTable.
1664 1665 1666 |
# File 'lib/yadriggy/ast.rb', line 1664 def initialize() @trees = {} end |
Instance Attribute Details
#trees ⇒ Hash (readonly)
Returns all the elements.
1662 1663 1664 |
# File 'lib/yadriggy/ast.rb', line 1662 def trees @trees end |
Instance Method Details
#[](context) ⇒ Object
Gets the value associated with the key.
1683 1684 1685 |
# File 'lib/yadriggy/ast.rb', line 1683 def [](context) @trees[context] end |
#[]=(context, ast) ⇒ Object
Records a key-value pair.
1671 1672 1673 |
# File 'lib/yadriggy/ast.rb', line 1671 def []=(context, ast) @trees[context] = ast end |
#delete(context) ⇒ Object
Deletes a key-value pair.
1677 1678 1679 |
# File 'lib/yadriggy/ast.rb', line 1677 def delete(context) @trees.delete(context) end |
#each(&blk) ⇒ Object
Executes a block once for each element.
1688 1689 1690 |
# File 'lib/yadriggy/ast.rb', line 1688 def each(&blk) @trees.each_value(&blk) end |