Class: Dentaku::AST::Access
- Inherits:
-
Object
- Object
- Dentaku::AST::Access
- Defined in:
- lib/dentaku/ast/access.rb
Class Method Summary collapse
Instance Method Summary collapse
- #dependencies(context = {}) ⇒ Object
-
#initialize(data_structure, index) ⇒ Access
constructor
A new instance of Access.
- #value(context = {}) ⇒ Object
Constructor Details
#initialize(data_structure, index) ⇒ Access
Returns a new instance of Access.
11 12 13 14 |
# File 'lib/dentaku/ast/access.rb', line 11 def initialize(data_structure, index) @structure = data_structure @index = index end |
Class Method Details
.arity ⇒ Object
4 5 6 |
# File 'lib/dentaku/ast/access.rb', line 4 def self.arity 2 end |
.peek ⇒ Object
8 9 |
# File 'lib/dentaku/ast/access.rb', line 8 def self.peek(*) end |
Instance Method Details
#dependencies(context = {}) ⇒ Object
22 23 24 |
# File 'lib/dentaku/ast/access.rb', line 22 def dependencies(context = {}) @structure.dependencies(context) + @index.dependencies(context) end |
#value(context = {}) ⇒ Object
16 17 18 19 20 |
# File 'lib/dentaku/ast/access.rb', line 16 def value(context = {}) structure = @structure.value(context) index = @index.value(context) structure[index] end |