module GuidesStyleMbland::NavigationMenu
Public Class Methods
check_for_orphaned_items(nav_data)
click to toggle source
# File lib/guides_style_mbland/navigation.rb, line 215 def self.check_for_orphaned_items(nav_data) orphan_urls = nav_data.map { |nav| nav[:orphan_url] }.compact unless orphan_urls.empty? fail(StandardError, "Parent pages missing for the following:\n " + orphan_urls.join("\n ")) end end
remove_stale_children(parent)
click to toggle source
# File lib/guides_style_mbland/navigation.rb, line 186 def self.remove_stale_children(parent) children = (parent['children'] || []) children.delete_if { |nav| nav['delete'] } parent.delete 'children' if children.empty? children.each { |child| remove_stale_children(child) } end