class Intersail::Rpdf::Node

Public Class Methods

new(hash) click to toggle source
# File lib/rpdf/models/node.rb, line 18
def initialize(hash)
  @hash = hash

  @name = hash[:name]

  subtags = hash[:childs][:tag_node] if hash[:childs] && hash[:childs][:tag_node]

  if subtags.kind_of? Array
    @children = subtags.map{|c| Node.new(c)}
  elsif subtags.kind_of? Hash
    @children = [Node.new(subtags)]
  end
end

Public Instance Methods

[](index) click to toggle source
# File lib/rpdf/models/node.rb, line 14
def [](index)
  @hash[index]
end
children() click to toggle source
# File lib/rpdf/models/node.rb, line 7
def children
  @children
end
has_children?() click to toggle source
# File lib/rpdf/models/node.rb, line 10
def has_children?
  @children && @children.respond_to?(:length) && @children.length>0
end
name() click to toggle source
# File lib/rpdf/models/node.rb, line 4
def name
  @name
end