Class: ArrayNode

Inherits:
SyntaxTree show all
Defined in:
lib/rpdf2txt-rockit/syntax_tree.rb

Instance Attribute Summary collapse

Attributes inherited from SyntaxTree

#children_names, #raw_src

Instance Method Summary collapse

Methods inherited from SyntaxTree

#==, #[], #compact!, #compact_childrens, #each_breadth_first, #each_node, #inspect_compact, #inspect_multi, #method_missing, #to_graph

Constructor Details

#initialize(values) ⇒ ArrayNode

Returns a new instance of ArrayNode.



425
426
427
# File 'lib/rpdf2txt-rockit/syntax_tree.rb', line 425

def initialize(values)
  super("_ArrayNode", value_names(values), values)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SyntaxTree

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



423
424
425
# File 'lib/rpdf2txt-rockit/syntax_tree.rb', line 423

def attributes
  @attributes
end

#childrensObject (readonly)

Returns the value of attribute childrens.



423
424
425
# File 'lib/rpdf2txt-rockit/syntax_tree.rb', line 423

def childrens
  @childrens
end

#nameObject (readonly)

Returns the value of attribute name.



423
424
425
# File 'lib/rpdf2txt-rockit/syntax_tree.rb', line 423

def name
  @name
end

Instance Method Details

#add_value(value, append = false) ⇒ Object



437
438
439
440
441
442
443
444
445
# File 'lib/rpdf2txt-rockit/syntax_tree.rb', line 437

def add_value(value, append = false)
  if append
    @childrens.push value
    @children_names.push "c#{@childrens.length}"
  else
    @childrens.unshift value
    @children_names.unshift "c#{@childrens.length}"
  end
end

#as_aObject



433
434
435
# File 'lib/rpdf2txt-rockit/syntax_tree.rb', line 433

def as_a
  @childrens
end

#deep_copyObject



429
430
431
# File 'lib/rpdf2txt-rockit/syntax_tree.rb', line 429

def deep_copy
  ArrayNode.new(@childrens.clone)
end