class Glaemscribe::API::Glaeml::Node

Attributes

args[RW]
children[R]
line[RW]
name[R]
parent_node[RW]
type[R]

Public Class Methods

new(line, type, name) click to toggle source
# File lib/api/glaeml.rb, line 62
def initialize(line, type, name)
  @line         = line
  @type         = type
  @name         = name
  @args         = []
  @children     = []
end

Public Instance Methods

element?() click to toggle source
# File lib/api/glaeml.rb, line 58
def element?
  @type == Type::ElementInline || @type == Type::ElementBlock
end
gpath(path) click to toggle source
# File lib/api/glaeml.rb, line 92
def gpath(path)
  apath = path.split(".")
  found = []
  pathfind_crawl(apath, found)
  found
end
initialize_copy(other) click to toggle source

Make our object clonable

Calls superclass method
# File lib/api/glaeml.rb, line 71
def initialize_copy(other)
  super
  @args = other.args.clone
  @children = other.children.map{|c| c.clone}
end
pathfind_crawl(apath, found) click to toggle source
# File lib/api/glaeml.rb, line 77
def pathfind_crawl(apath, found)

  children.each{ |c|
    if(c.name == apath[0])
      if apath.count == 1
        found << c
      else
        bpath = apath.dup
        bpath.shift
        c.pathfind_crawl(bpath, found)
      end
    end
  }
end
text?() click to toggle source
# File lib/api/glaeml.rb, line 54
def text?
  @type == Type::Text
end