Class: TracWiki::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/trac-wiki/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, par = nil, attrs = {}, cont = []) ⇒ Node

Returns a new instance of Node.



18
19
20
21
22
23
24
25
# File 'lib/trac-wiki/tree.rb', line 18

def initialize(tag_name, par=nil, attrs={}, cont=[])
  @tag = nil
  @tag = tag_name.to_sym if tag_name
  @par = par
  cont = [ cont ] if cont.is_a? String
  @cont = cont || []
  @attrs = attrs || {}
end

Instance Attribute Details

#attrsObject

Returns the value of attribute attrs.



17
18
19
# File 'lib/trac-wiki/tree.rb', line 17

def attrs
  @attrs
end

#contObject

Returns the value of attribute cont.



16
17
18
# File 'lib/trac-wiki/tree.rb', line 16

def cont
  @cont
end

#parObject

Returns the value of attribute par.



15
16
17
# File 'lib/trac-wiki/tree.rb', line 15

def par
  @par
end

#tagObject

Returns the value of attribute tag.



14
15
16
# File 'lib/trac-wiki/tree.rb', line 14

def tag
  @tag
end

Instance Method Details

#add(cont) ⇒ Object



27
28
29
# File 'lib/trac-wiki/tree.rb', line 27

def add(cont)
  @cont << cont
end