Skip to content

Commit 0aa9ba1

Browse files
committed
Add new RDoc feature: Render mixed-in methods and constants
1 parent a2679f7 commit 0aa9ba1

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

lib/rdoc/generator/template/rorvswild/class.rhtml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
<%- constants.each do |const| -%>
3131
<dt id="<%= const.name %>"><%= const.name %></dt>
3232
<%- if const.comment then -%>
33-
<dd><%= const.description.strip %></dd>
33+
<dd>
34+
<%- if const.mixin_from then -%>
35+
<div class="mixin-from">
36+
Included from <a href="<%= klass.aref_to(const.mixin_from.path)%>"><%= const.mixin_from.full_name %></a>
37+
</div>
38+
<%- end -%>
39+
<%= const.description.strip %>
40+
</dd>
3441
<%- else -%>
3542
<dd class="missing-docs">(Not documented)</dd>
3643
<%- end -%>
@@ -54,6 +61,11 @@
5461
</div>
5562

5663
<div class="method-description">
64+
<%- if attrib.mixin_from then -%>
65+
<div class="mixin-from">
66+
<%= attrib.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(attrib.mixin_from.path)%>"><%= attrib.mixin_from.full_name %></a>
67+
</div>
68+
<%- end -%>
5769
<%- if attrib.comment then -%>
5870
<%= attrib.description.strip %>
5971
<%- else -%>
@@ -107,6 +119,11 @@
107119

108120
<%- unless method.skip_description? then -%>
109121
<div class="method-description">
122+
<%- if method.mixin_from then -%>
123+
<div class="mixin-from">
124+
<%= method.singleton ? "Extended" : "Included" %> from <a href="<%= klass.aref_to(method.mixin_from.path)%>"><%= method.mixin_from.full_name %></a>
125+
</div>
126+
<%- end -%>
110127
<%- if method.comment then -%>
111128
<%= method.description.strip %>
112129
<%- else -%>

lib/rdoc/generator/template/rorvswild/css/rdoc.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,12 @@ pre + .toggle-source { margin-top: 0.5rem; }
736736
.method-description p { margin: 0; }
737737

738738
.method-description ul { margin-left: 1.5em; }
739+
740+
main .mixin-from {
741+
font-size: 0.823em;
742+
font-style: italic;
743+
margin-bottom: 0.75em;
744+
}
739745

740746
#attribute-method-details .method-detail:hover {
741747
background-color: transparent;

0 commit comments

Comments
 (0)