class Spirit::Render::Navigation

Keeps track of document sections and renders a navigation bar.

Public Class Methods

new() click to toggle source

Creates a new navigation bar.

# File lib/spirit/render/templates/navigation.rb, line 14
def initialize
  @sections = {}
end

Public Instance Methods

append(heading, name) click to toggle source

Adds a new section. @param [String] heading section heading @param [String] name anchor name @return [void]

# File lib/spirit/render/templates/navigation.rb, line 22
def append(heading, name)
  @sections[name] = heading
end
render(locals={}) click to toggle source

Renders the navigation bar in HTML.

Calls superclass method
# File lib/spirit/render/templates/navigation.rb, line 27
def render(locals={})
  super locals.merge(sections: @sections)
end