Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/compiler/crystal/tools/doc/html/type.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ <h2>
<code><%= type.formatted_alias_definition %></code>
<% end %>

<%= OtherTypesTemplate.new("Included Modules", type, type.included_modules) %>
<%= OtherTypesTemplate.new("Extended Modules", type, type.extended_modules) %>
<%= OtherTypesTemplate.new("Direct Known Subclasses", type, type.subclasses) %>
<%= OtherTypesTemplate.new("Direct including types", type, type.including_types) %>
<%= OtherTypesTemplate.new("Included Modules", type, included_modules_with_docs) %>
<%= OtherTypesTemplate.new("Extended Modules", type, extended_modules_with_docs) %>
<%= OtherTypesTemplate.new("Direct Known Subclasses", type, subclasses_with_docs) %>
<%= OtherTypesTemplate.new("Direct including types", type, including_types_with_docs) %>

<% if locations = type.locations %>
<h2>
Expand Down Expand Up @@ -99,7 +99,7 @@ <h2>
<%= MethodSummaryTemplate.new("Instance Method Summary", type.instance_methods) %>

<div class="methods-inherited">
<% type.ancestors.each do |ancestor| %>
<% ancestors_with_docs.each do |ancestor| %>
<%= MethodsInheritedTemplate.new(type, ancestor, ancestor.instance_methods, "Instance") %>
<%= MethodsInheritedTemplate.new(type, ancestor, ancestor.constructors, "Constructor") %>
<%= MethodsInheritedTemplate.new(type, ancestor, ancestor.class_methods, "Class") %>
Expand Down
6 changes: 6 additions & 0 deletions src/compiler/crystal/tools/doc/templates.cr
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ module Crystal::Doc
end

record TypeTemplate, type : Type, types : Array(Type), project_info : ProjectInfo do
{% for method in %w[ancestors included_modules extended_modules subclasses including_types] %}
def {{method.id}}_with_docs
type.{{method.id}}.select!(&.in?(types))
end
{% end %}

ECR.def_to_s "#{__DIR__}/html/type.html"
end

Expand Down