%############ Class/Module title #############%>
<% if classmod.module? %>
Module <%= classmod.full_name %>
<% else %>
Class <%= classmod.full_name %>
<% if classmod.superclass.kind_of?(String) %>
Parent: <%= classmod.superclass %>
<% else %>
Parent: <%= classmod.superclass.full_name %>
<% end %>
<% end %>
<%############ Method overview #############%>
<% unless classmod.method_list.empty? %>
<% end %>
<%############ Description #############%>
<%= classmod.description %>
<%############ Includes #############%>
<% unless classmod.includes.empty? %>
Includes
<% classmod.includes.sort_by(&:name).each do |inc| %>
-
<% result = inc.module %>
<% if result.kind_of?(String) %>
<%= result %>
<% else %>
<%= result.full_name %>
<% end %>
<% end %>
<% end %>
<%############ Constants #############%>
<% unless classmod.constants.empty? %>
Constants
Name | Value | Description |
<% classmod.constants.each do |const| %>
<% abbrev_value = const.value.chars.count > 20 ? const.value.chars.first(20).join + "..." : const.value %>
<%= const.name %> | <%= abbrev_value %> | <%= const.description %> |
<% end %>
<% end %>
<%############ Attributes #############%>
<% unless classmod.attributes.empty? %>
Attributes
<% classmod.attributes.sort_by(&:name).each do |attr| %>
- <%= "#{attr.name}[#{attr.rw}]" %>
<%= attr.description %>
<% end %>
<% end %>
<%############ Methods #############%>
<% methods_by_type = classmod.methods_by_type %>
<% ["class", "instance"].each do |type| %> <%# Yes, these are strings... %>
<% [:public, :protected, :private].each do |visibility| %> <%# ...and these symbols. %>
<%# Where there are no methods defined, there is no need for docs. %>
<% next if methods_by_type[type].empty? %>
<% next if methods_by_type[type][visibility].empty? %>
"><%= "#{visibility.capitalize} #{type.capitalize} Methods" %>
<% methods_by_type[type][visibility].sort_by(&:name).each do |method| %>
" id="<%= method.aref %>">
<%= method.description %>
<%# Source link and display %>
[Show source]
<%= method.markup_code %>
<% end %>
<% end %>
<% end %>