class Navigatrix::Rendering::Strategies::List

Attributes

item_options[R]
options[R]

Public Class Methods

new(items, list_options = {}, item_options = {}) click to toggle source
# File lib/navigatrix/rendering/strategies/list.rb, line 14
def initialize(items, list_options = {}, item_options = {})
  @items        = items || []
  @options      = list_options
  @item_options = item_options
end

Public Instance Methods

render() click to toggle source
# File lib/navigatrix/rendering/strategies/list.rb, line 20
def render
  content_tag(:ul, render_items, html_attributes)
end

Private Instance Methods

html_attributes() click to toggle source
# File lib/navigatrix/rendering/strategies/list.rb, line 38
def html_attributes
  HTMLAttributes.new(options[:html_attributes])
end
item_class() click to toggle source
# File lib/navigatrix/rendering/strategies/list.rb, line 34
def item_class
  StrategyFactory.find_item_strategy(item_options[:renderer])
end
items() click to toggle source
# File lib/navigatrix/rendering/strategies/list.rb, line 30
def items
  @items.map { |item| item_class.new(item, item_options) }
end
render_items() click to toggle source
# File lib/navigatrix/rendering/strategies/list.rb, line 26
def render_items
  items.map(&:render).join.html_safe
end