Class: SimpleNavigation::Renderer::Base

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
Defined in:
lib/simple_navigation/renderer/base.rb

Overview

This is the base class for all renderers.

A renderer is responsible for rendering an ItemContainer and its containing items to HTML.

Direct Known Subclasses

List

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

:nodoc:



26
27
28
# File 'lib/simple_navigation/renderer/base.rb', line 26

def initialize #:nodoc:
  @controller = SimpleNavigation.controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



11
12
13
# File 'lib/simple_navigation/renderer/base.rb', line 11

def controller
  @controller
end

Class Method Details

.controller_method(*methods) ⇒ Object

Delegates method calls to the controller.



16
17
18
19
20
# File 'lib/simple_navigation/renderer/base.rb', line 16

def controller_method(*methods)
  methods.each do |method|
    delegate method, :to => :controller
  end
end

Instance Method Details

#render(item_container, include_sub_navigation = false, options = {}) ⇒ Object

Renders the specified ItemContainer to HTML.

If include_sub_navigation is set to true, the renderer should nest the sub_navigation for the active navigation inside that navigation item.

A renderer should also take the option SimpleNavigation.config.render_all_levels into account. If it is set to true then it should render all navigation levels independent of the include_sub_navigation option.



38
39
40
# File 'lib/simple_navigation/renderer/base.rb', line 38

def render(item_container, include_sub_navigation=false,options={})
  raise 'subclass responsibility'
end