Class: Koara::Ast::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/koara/ast/node.rb

Direct Known Subclasses

BlockElement, Code, Document, Em, Image, LineBreak, Link, Strong, Text

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#childrenObject

Returns the value of attribute children.



9
10
11
# File 'lib/koara/ast/node.rb', line 9

def children
  @children
end

#parentObject

Returns the value of attribute parent.



7
8
9
# File 'lib/koara/ast/node.rb', line 7

def parent
  @parent
end

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/koara/ast/node.rb', line 8

def value
  @value
end

Instance Method Details

#add(n, i) ⇒ Object



11
12
13
14
15
16
# File 'lib/koara/ast/node.rb', line 11

def add(n, i)
  if @children.nil?
    @children = Array.new
  end
  @children[i] = n
end

#children_accept(renderer) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/koara/ast/node.rb', line 18

def children_accept(renderer)
  if !@children.nil?
    i = 0
    while i < @children.length
      @children[i].accept(renderer)
      i += 1
    end
  end
end