diff --git a/lib/puppetx/yardoc/yard/code_objects/host_class_object.rb b/lib/puppetx/yardoc/yard/code_objects/host_class_object.rb index d3abcf6..179ce0b 100644 --- a/lib/puppetx/yardoc/yard/code_objects/host_class_object.rb +++ b/lib/puppetx/yardoc/yard/code_objects/host_class_object.rb @@ -33,5 +33,20 @@ module Puppetx::Yardoc::YARD::CodeObjects yield(obj) if block_given? obj end + + def inheritance_tree + if parent_class.is_a?(HostClassObject) + # Cool. We got a host class. Return self + parent inheritance tree. + [self] + parent_class.inheritance_tree + elsif parent_class.is_a?(YARD::CodeObjects::Proxy) + # We have a reference to a parent that has not been created yet. Just + # return it. + [self, parent_class] + else + # Most likely no parent class. But also possibly an object that we + # shouldn't inherit from. Just return self. + [self] + end + end end end diff --git a/lib/puppetx/yardoc/yard/templates/default/hostclass/html/box_info.erb b/lib/puppetx/yardoc/yard/templates/default/hostclass/html/box_info.erb index 0a7ce34..334c764 100644 --- a/lib/puppetx/yardoc/yard/templates/default/hostclass/html/box_info.erb +++ b/lib/puppetx/yardoc/yard/templates/default/hostclass/html/box_info.erb @@ -3,8 +3,13 @@ <% if object.parent_class %>
Inherits:
- <%= linkify object.parent_class %> - <%# TODO: Add inheritance tree. %> + <%= linkify object.parent_class, object.parent_class.path %> + + show all
<% n = 2 %> <% end %>