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.



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

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.



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

def children
  @children
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#parentObject

Returns the value of attribute parent.



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

def parent
  @parent
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

#titleObject (readonly)

Returns the value of attribute title.



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

def title
  @title
end

Instance Method Details

#add_child(child) ⇒ Object



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

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

#hrefObject



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

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