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.



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

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.



106
107
108
# File 'lib/double_doc/html_generator.rb', line 106

def children
  @children
end

#idObject (readonly)

Returns the value of attribute id.



106
107
108
# File 'lib/double_doc/html_generator.rb', line 106

def id
  @id
end

#parentObject

Returns the value of attribute parent.



107
108
109
# File 'lib/double_doc/html_generator.rb', line 107

def parent
  @parent
end

#pathObject (readonly)

Returns the value of attribute path.



106
107
108
# File 'lib/double_doc/html_generator.rb', line 106

def path
  @path
end

#titleObject (readonly)

Returns the value of attribute title.



106
107
108
# File 'lib/double_doc/html_generator.rb', line 106

def title
  @title
end

Instance Method Details

#add_child(child) ⇒ Object



116
117
118
119
120
# File 'lib/double_doc/html_generator.rb', line 116

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

#hrefObject



122
123
124
125
126
127
128
# File 'lib/double_doc/html_generator.rb', line 122

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