Class: SXRB::Node

Inherits:
Struct
  • Object
show all
Defined in:
lib/sxrb/node.rb

Direct Known Subclasses

TextNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ Node

Returns a new instance of Node.


4
5
6
7
# File 'lib/sxrb/node.rb', line 4

def initialize(*args, &block)
  super(*args, &block)
  @children = []
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes


2
3
4
# File 'lib/sxrb/node.rb', line 2

def attributes
  @attributes
end

#childrenObject

Returns the value of attribute children


3
4
5
# File 'lib/sxrb/node.rb', line 3

def children
  @children
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name


2
3
4
# File 'lib/sxrb/node.rb', line 2

def name
  @name
end

#namespacesObject

Returns the value of attribute namespaces

Returns:

  • (Object)

    the current value of namespaces


2
3
4
# File 'lib/sxrb/node.rb', line 2

def namespaces
  @namespaces
end

#parentObject

Returns the value of attribute parent

Returns:

  • (Object)

    the current value of parent


2
3
4
# File 'lib/sxrb/node.rb', line 2

def parent
  @parent
end

#prefixObject

Returns the value of attribute prefix

Returns:

  • (Object)

    the current value of prefix


2
3
4
# File 'lib/sxrb/node.rb', line 2

def prefix
  @prefix
end

#uriObject

Returns the value of attribute uri

Returns:

  • (Object)

    the current value of uri


2
3
4
# File 'lib/sxrb/node.rb', line 2

def uri
  @uri
end

Instance Method Details

#append(node) ⇒ Object


9
10
11
12
# File 'lib/sxrb/node.rb', line 9

def append(node)
  node.parent = self
  @children << node
end