Class: Keisan::AST::Indexing
- Inherits:
-
UnaryOperator
- Object
- Node
- Parent
- UnaryOperator
- Keisan::AST::Indexing
- Defined in:
- lib/keisan/ast/indexing.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
Attributes inherited from Parent
Instance Method Summary collapse
-
#initialize(child, arguments = []) ⇒ Indexing
constructor
A new instance of Indexing.
- #value(context = nil) ⇒ Object
Constructor Details
#initialize(child, arguments = []) ⇒ Indexing
Returns a new instance of Indexing.
6 7 8 9 |
# File 'lib/keisan/ast/indexing.rb', line 6 def initialize(child, arguments = []) @children = [child] @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
4 5 6 |
# File 'lib/keisan/ast/indexing.rb', line 4 def arguments @arguments end |
Instance Method Details
#value(context = nil) ⇒ Object
11 12 13 |
# File 'lib/keisan/ast/indexing.rb', line 11 def value(context = nil) return children.first.value(context).send(:[], *arguments.map {|arg| arg.value(context)}) end |