Class: GovukNavigationHelpers::Breadcrumbs
- Inherits:
-
Object
- Object
- GovukNavigationHelpers::Breadcrumbs
- Defined in:
- lib/govuk_navigation_helpers/breadcrumbs.rb
Instance Method Summary collapse
- #breadcrumbs ⇒ Object
-
#initialize(content_item) ⇒ Breadcrumbs
constructor
A new instance of Breadcrumbs.
Constructor Details
#initialize(content_item) ⇒ Breadcrumbs
Returns a new instance of Breadcrumbs.
3 4 5 |
# File 'lib/govuk_navigation_helpers/breadcrumbs.rb', line 3 def initialize(content_item) @content_item = ContentItem.new(content_item) end |
Instance Method Details
#breadcrumbs ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/govuk_navigation_helpers/breadcrumbs.rb', line 7 def ordered_parents = all_parents.map do |parent| { title: parent.title, url: parent.base_path } end ordered_parents << { title: "Home", url: "/" } { breadcrumbs: ordered_parents.reverse } end |