Permalink
Browse files

Respect --all option

  • Loading branch information...
1 parent e4ce2ad commit 2ee4bf6fc03f3129344125cb679af35195cf31c6 @voloko voloko committed Mar 29, 2009
Showing with 18 additions and 5 deletions.
  1. +7 −2 lib/sdoc/generator/shtml.rb
  2. +11 −3 lib/sdoc/generator/template/shtml/_context.rhtml
@@ -188,11 +188,16 @@ def add_class_search_index(index)
def add_method_search_index(index)
debug_msg " generating method search index"
- @classes.map { |klass|
+ list = @classes.map { |klass|
klass.method_list
}.flatten.sort{ |a, b| a.name <=> b.name }.select { |method|
method.document_self
- }.each do |method|
+ }
+ unless @options.show_all
+ list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
+ end
+
+ list.each do |method|
index[:searchIndex].push( search_string(method.name) )
index[:longSearchIndex].push( search_string(method.parent.name) )
index[:info].push([
@@ -22,10 +22,16 @@
</ul>
<% end %>
- <% unless context.method_list.empty? %>
+ <%
+ list = context.method_list
+ unless @options.show_all
+ list = list.find_all {|m| m.visibility == :public || m.visibility == :protected || m.force_documentation }
+ end
+ %>
+ <% unless list.empty? %>
<div class="sectiontitle">Methods</div>
<ul>
- <% context.method_list.sort{ |a, b| a.name <=> b.name }.each do |method| %>
+ <% list.sort{ |a, b| a.name <=> b.name }.each do |method| %>
<li><a href="#<%= method.aref %>"><%= method.name %></a></li>
<% end %>
</ul>
@@ -102,7 +108,9 @@
<% context.methods_by_type.each do |type, visibilities|
next if visibilities.empty?
visibilities.each do |visibility, methods|
- next if methods.empty? %>
+ next if methods.empty?
+ next unless visibility == :public || visibility == :protected || methods.any? {|m| m.force_documentation }
+ %>
<div class="sectiontitle"><%= type.capitalize %> <%= visibility.to_s.capitalize %> methods</div>
<% methods.each do |method| %>
<div class="method">

0 comments on commit 2ee4bf6

Please sign in to comment.