Class: Keisan::AST::Parent

Inherits:
Node
  • Object
show all
Defined in:
lib/keisan/ast/parent.rb

Direct Known Subclasses

Function, List, Operator, UnaryOperator

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#value

Constructor Details

#initialize(children = []) ⇒ Parent

Returns a new instance of Parent.



6
7
8
9
10
11
12
# File 'lib/keisan/ast/parent.rb', line 6

def initialize(children = [])
  children = Array.wrap(children)
  unless children.is_a?(Array) && children.all? {|children| children.is_a?(Node)}
    raise Keisan::Exceptions::InternalError.new
  end
  @children = children
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



4
5
6
# File 'lib/keisan/ast/parent.rb', line 4

def children
  @children
end