Sha256: 3d697833f92f59a2ea2491941316a9ec891acbd34cf69a21f8d75c7b3898cec8
Contents?: true
Size: 678 Bytes
Versions: 40
Compression:
Stored size: 678 Bytes
Contents
module GovukNavigationHelpers class Breadcrumbs def initialize(content_item) @content_item = ContentItem.new(content_item) end def breadcrumbs 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 private attr_reader :content_item def all_parents parents = [] direct_parent = content_item.parent while direct_parent parents << direct_parent direct_parent = direct_parent.parent end parents end end end
Version data entries
40 entries across 40 versions & 1 rubygems