Class: BreadcrumbsOnRails::Breadcrumbs::SimpleBuilder

Inherits:
Builder
  • Object
show all
Defined in:
lib/breadcrumbs_on_rails/breadcrumbs.rb

Overview

SimpleBuilder

The SimpleBuilder is the default breadcrumb builder. It provides basic functionalities to render a breadcrumb navigation.

The SimpleBuilder accepts a limited set of options. If you need more flexibility, create a custom Builder and pass the option :builder => BuilderClass to the render_breadcrumbs helper method.

Instance Method Summary collapse

Methods inherited from Builder

#initialize

Constructor Details

This class inherits a constructor from BreadcrumbsOnRails::Breadcrumbs::Builder

Instance Method Details

#renderObject



103
104
105
106
107
# File 'lib/breadcrumbs_on_rails/breadcrumbs.rb', line 103

def render
  @elements.collect do |element|
    render_element(element)
  end.join(@options[:separator] || " » ")
end

#render_element(element) ⇒ Object



109
110
111
112
113
114
115
116
# File 'lib/breadcrumbs_on_rails/breadcrumbs.rb', line 109

def render_element(element)
  content = @context.link_to_unless_current(compute_name(element), compute_path(element))
  if @options[:tag]
    @context.(@options[:tag], content)
  else
    content
  end
end