From 32d69848e1c69e1a483b1896ca6b00ee526262cf Mon Sep 17 00:00:00 2001 From: Charlie Sharpsteen Date: Thu, 12 Jun 2014 21:15:50 -0700 Subject: [PATCH] Small fixes to the namespace_list template helper The `namespace_list` helper is used to filter YARD objects in order to populate search lists. The code was originally derived from the `class_list` helper. This patch guards against calling `children` on objects that have no children and removes a recursive call to the old `class_list` method. --- .../yardoc/yard/templates/default/fulldoc/html/setup.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb index ba90602..b75486a 100644 --- a/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb +++ b/lib/puppetx/yardoc/yard/templates/default/fulldoc/html/setup.rb @@ -34,7 +34,7 @@ def namespace_list(opts = {}) children.reject {|c| c.nil? }.sort_by {|child| child.path }.map do |child| if namespace_types.include? child.type name = child.namespace.is_a?(CodeObjects::Proxy) ? child.path : child.name - has_children = run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) } + has_children = child.respond_to?(:children) && run_verifier(child.children).any? {|o| o.is_a?(CodeObjects::NamespaceObject) } out << "
  • " out << " " if has_children out << linkify(child, name) @@ -43,7 +43,7 @@ def namespace_list(opts = {}) out << child.namespace.title out << "" out << "
  • " - out << "" if has_children + out << "" if has_children end end out