summaryrefslogtreecommitdiff
path: root/lib/rdoc/generator
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-10 16:17:09 -0700
committeraycabta <aycabta@gmail.com>2020-05-24 23:47:24 +0900
commit7e7981c84f8cd3225b5e915cba2281869a08b784 (patch)
treec18b72aca8c83a5f976399be5f6df9aadf00bc96 /lib/rdoc/generator
parentf52a4690f8fbd495e8517178a0bf95c69ccea47c (diff)
[ruby/rdoc] Treat multiple Ruby methods calling the same C method as aliases
Previously, only calls to rb_define_alias were treated as aliases. This treats calls to rb_define_method with the same C function as aliases, with the first function defined being the primary method. This move the dedup code from the C parser to AnyMethod, and has AnyMethod look in its aliases to find the call_seq. Switch the deduplication code to remove lines matching one of the other aliases, instead of only keeping lines matching the current alias. The previous approach could eliminate all call_seq lines in cases where no line matched. This was necessary to pass tests when call_seq does deduplication by default. The only change to the darkfish template is to not perform unnecessary work by deduplicating twice. https://github.com/ruby/rdoc/commit/0ead78616b
Diffstat (limited to 'lib/rdoc/generator')
-rw-r--r--lib/rdoc/generator/template/darkfish/class.rhtml4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml
index 7733095086..596764ddc5 100644
--- a/lib/rdoc/generator/template/darkfish/class.rhtml
+++ b/lib/rdoc/generator/template/darkfish/class.rhtml
@@ -98,8 +98,8 @@
<% methods.each do |method| %>
<div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
- <% if method.call_seq then %>
- <% method.call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
+ <% if (call_seq = method.call_seq) then %>
+ <% call_seq.strip.split("\n").each_with_index do |call_seq, i| %>
<div class="method-heading">
<span class="method-callseq">
<%= h(call_seq.strip.