class Intersail::Rpdf::TagArray

Attributes

array[R]

Public Class Methods

new(node) click to toggle source
# File lib/rpdf/models/tag_array.rb, line 6
def initialize(node)
  @array = []
  build_array(node) if(node.respond_to?(:has_children?) && node.has_children?)
end

Private Instance Methods

build_array(node, basename = '') click to toggle source
# File lib/rpdf/models/tag_array.rb, line 13
def build_array(node, basename = '')
  if node.name.present?
    basename =  basename.empty? ? node.name : "#{basename}.#{node.name}"
  end

  node.children.each do |child|
    if(child.has_children?)
      build_array(child, basename)
    else
      @array.append(basename.empty? ? child.name : "#{basename}.#{child.name}")
    end
  end
end