Class: GovukNavigationHelpers::RummagerTaxonomySidebarLinks
- Inherits:
-
Object
- Object
- GovukNavigationHelpers::RummagerTaxonomySidebarLinks
- Defined in:
- lib/govuk_navigation_helpers/rummager_taxonomy_sidebar_links.rb
Instance Method Summary collapse
-
#initialize(content_item) ⇒ RummagerTaxonomySidebarLinks
constructor
A new instance of RummagerTaxonomySidebarLinks.
- #related_items ⇒ Object
Constructor Details
#initialize(content_item) ⇒ RummagerTaxonomySidebarLinks
Returns a new instance of RummagerTaxonomySidebarLinks.
3 4 5 |
# File 'lib/govuk_navigation_helpers/rummager_taxonomy_sidebar_links.rb', line 3 def initialize(content_item) @content_item = content_item end |
Instance Method Details
#related_items ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/govuk_navigation_helpers/rummager_taxonomy_sidebar_links.rb', line 7 def parent_taxons = @content_item.parent_taxons = Set.new parent_taxons.each_with_index.map do |parent_taxon, index| = index < 2 ? (parent_taxon, ) : [] .merge( .map { |content| content[:link] } ) { title: parent_taxon.title, url: parent_taxon.base_path, description: parent_taxon.description, related_content: , } end end |