Display inheritance relationships for host classes
This commit is contained in:
parent
a051319b34
commit
d8bc2f3dce
|
@ -5,6 +5,10 @@ require_relative '../../../yardoc'
|
|||
|
||||
module Puppetx::Yardoc::YARD::CodeObjects
|
||||
class HostClassObject < YARD::CodeObjects::NamespaceObject
|
||||
# The {HostClassObject} that this class inherits from, if any.
|
||||
# @return [HostClassObject, Proxy, nil]
|
||||
attr_accessor :parent_class
|
||||
|
||||
# The `YARD::Codeobjects::Base` class pulls a bunch of shenanigans to
|
||||
# insert proxy namespaces. Unfortunately, said shenanigans pick up on the
|
||||
# `::` in Puppet names and start to mangle things based on rules for the
|
||||
|
|
|
@ -5,7 +5,15 @@ module Puppetx::Yardoc::YARD::Handlers
|
|||
handles HostClassDefinition
|
||||
|
||||
process do
|
||||
register HostClassObject.new(:root, statement.pops_obj.name)
|
||||
obj = HostClassObject.new(:root, statement.pops_obj.name)
|
||||
|
||||
statement.pops_obj.tap do |o|
|
||||
if o.parent_class
|
||||
obj.parent_class = P(:root, o.parent_class)
|
||||
end
|
||||
end
|
||||
|
||||
register obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<% n = 1 %>
|
||||
<dl class="box">
|
||||
<% if object.parent_class %>
|
||||
<dt class="r<%=n%>">Inherits:</dt>
|
||||
<dd class="r<%=n%>">
|
||||
<span class="inheritName"><%= linkify object.parent_class %></span>
|
||||
<%# TODO: Add inheritance tree. %>
|
||||
</dd>
|
||||
<% n = 2 %>
|
||||
<% end %>
|
||||
<% unless object.root? %>
|
||||
<dt class="r<%=n%> last">Defined in:</dt>
|
||||
<dd class="r<%=n%> last"><%= erb(:defines) %></dd>
|
||||
<% end %>
|
||||
</dl>
|
||||
<div class="clear"></div>
|
||||
|
Loading…
Reference in New Issue