Module: BreadcrumbTrail::ActionController::HelperMethods
- Defined in:
- lib/breadcrumb_trail/action_controller.rb
Overview
This is both included in the controller and used as a helper, so any methods defined here are usable in both the controller and in the views. These methods are the primary interface that the developer uses to define and render breadcrumbs.
Instance Method Summary collapse
-
#breadcrumb(options) { ... } ⇒ void
Define a breadcrumb with the given options.
-
#breadcrumbs ⇒ Array<Breadcrumb>
All of the defined breadcrumbs, in order.
-
#render_breadcrumbs(options = {}) { ... } ⇒ String
Renders the defined breadcrumbs, with the given options.
Instance Method Details
#breadcrumb(options) { ... } ⇒ void
This method returns an undefined value.
Define a breadcrumb with the given options. All of this information is passed directly to the Breadcrumb initializer.
45 46 47 |
# File 'lib/breadcrumb_trail/action_controller.rb', line 45 def (, &block) << Breadcrumb.new(**, &block) end |
#breadcrumbs ⇒ Array<Breadcrumb>
All of the defined breadcrumbs, in order.
52 53 54 |
# File 'lib/breadcrumb_trail/action_controller.rb', line 52 def ||= [] end |
#render_breadcrumbs(options = {}) { ... } ⇒ String
Renders the defined breadcrumbs, with the given options.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/breadcrumb_trail/action_controller.rb', line 64 def ( = {}, &block) block_given = block_given? builder = .fetch(:builder) do if block_given BlockBuilder else HTMLBuilder end end builder.new(self, , , &block).call end |