Class: DoubleDoc::HtmlGenerator::SitemapItem

Inherits:
Object
  • Object
show all
Defined in:
lib/double_doc/html_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, path, id = nil) ⇒ SitemapItem

Returns a new instance of SitemapItem.



113
114
115
116
117
118
# File 'lib/double_doc/html_generator.rb', line 113

def initialize(title, path, id = nil)
  @title    = title
  @path     = path
  @id       = id
  @children = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



110
111
112
# File 'lib/double_doc/html_generator.rb', line 110

def children
  @children
end

#idObject (readonly)

Returns the value of attribute id.



110
111
112
# File 'lib/double_doc/html_generator.rb', line 110

def id
  @id
end

#parentObject

Returns the value of attribute parent.



111
112
113
# File 'lib/double_doc/html_generator.rb', line 111

def parent
  @parent
end

#pathObject (readonly)

Returns the value of attribute path.



110
111
112
# File 'lib/double_doc/html_generator.rb', line 110

def path
  @path
end

#titleObject (readonly)

Returns the value of attribute title.



110
111
112
# File 'lib/double_doc/html_generator.rb', line 110

def title
  @title
end

Instance Method Details

#add_child(child) ⇒ Object



120
121
122
123
124
# File 'lib/double_doc/html_generator.rb', line 120

def add_child(child)
  child.parent = self
  children << child
  child
end

#hrefObject



126
127
128
129
130
131
132
# File 'lib/double_doc/html_generator.rb', line 126

def href
  if id
    "#{path}##{id}"
  else
    path
  end
end