class XMLBuilder::PathParser::Node

Helper class used by PathParser

Helper class used by PathParser

Attributes

attribute[R]
document[R]
element[R]
index[R]

Public Class Methods

new(allow_document, nodes) click to toggle source

Nodes is path.split('/')

# File lib/ec2/amitools/xmlbuilder.rb, line 99
def initialize(allow_document, nodes)
  if allow_document && nodes[0] == ''
    @document = true
    nodes.shift
    return
  end
  nodes.shift while nodes[0] == ''
  node = nodes.shift
  if (match = @@node_regex.match(node))
    @element = match[1]
    @index = match[2].to_i || 0
  elsif (match = @@attribute_regex.match(node))
    @attribute = match[1]
  else
    raise 'Invalid path: Node must be of the form element[index] or @attribute' if document
  end
end