mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/rdoc: Update to RDoc 4.1.0.preview.1
RDoc 4.1.0 contains a number of enhancements including a new default style and accessibility support. You can see the changelog here: https://github.com/rdoc/rdoc/blob/v4.1.0.preview.1/History.rdoc * test/rdoc: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fed428007c
commit
df7dac9174
118 changed files with 5394 additions and 3600 deletions
|
@ -173,6 +173,9 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
@classes = load_variable_map :c_class_variables
|
||||
@singleton_classes = load_variable_map :c_singleton_class_variables
|
||||
|
||||
# class_variable => { function => [method, ...] }
|
||||
@methods = Hash.new { |h, f| h[f] = Hash.new { |i, m| i[m] = [] } }
|
||||
|
||||
# missing variable => [handle_class_module arguments]
|
||||
@missing_dependencies = {}
|
||||
|
||||
|
@ -206,6 +209,47 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
end
|
||||
end
|
||||
|
||||
##
|
||||
# Removes duplicate call-seq entries for methods using the same
|
||||
# implementation.
|
||||
|
||||
def deduplicate_call_seq
|
||||
@methods.each do |var_name, functions|
|
||||
class_name = @known_classes[var_name]
|
||||
class_obj = find_class var_name, class_name
|
||||
|
||||
functions.each_value do |method_names|
|
||||
next if method_names.length == 1
|
||||
|
||||
method_names.each do |method_name|
|
||||
deduplicate_method_name class_obj, method_name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
# If two ruby methods share a C implementation (and comment) this
|
||||
# deduplicates the examples in the call_seq for the method to reduce
|
||||
# confusion in the output.
|
||||
|
||||
def deduplicate_method_name class_obj, method_name # :nodoc:
|
||||
return unless
|
||||
method = class_obj.method_list.find { |m| m.name == method_name }
|
||||
return unless call_seq = method.call_seq
|
||||
|
||||
method_name = method_name[0, 1] if method_name =~ /\A\[/
|
||||
|
||||
entries = call_seq.split "\n"
|
||||
|
||||
matching = entries.select do |entry|
|
||||
entry =~ /^\w*\.?#{Regexp.escape method_name}/ or
|
||||
entry =~ /\s#{Regexp.escape method_name}\s/
|
||||
end
|
||||
|
||||
method.call_seq = matching.join "\n"
|
||||
end
|
||||
|
||||
##
|
||||
# Scans #content for rb_define_alias
|
||||
|
||||
|
@ -422,7 +466,7 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
)
|
||||
\s*\(\s*([\w\.]+),
|
||||
\s*"([^"]+)",
|
||||
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
|
||||
\s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(METHOD\))?(\w+)\)?,
|
||||
\s*(-?\w+)\s*\)
|
||||
(?:;\s*/[*/]\s+in\s+(\w+?\.(?:cpp|c|y)))?
|
||||
%xm) do |type, var_name, meth_name, function, param_count, source_file|
|
||||
|
@ -938,6 +982,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
class_name = @known_classes[var_name]
|
||||
singleton = @singleton_classes.key? var_name
|
||||
|
||||
@methods[var_name][function] << meth_name
|
||||
|
||||
return unless class_name
|
||||
|
||||
class_obj = find_class var_name, class_name
|
||||
|
@ -1172,6 +1218,8 @@ class RDoc::Parser::C < RDoc::Parser
|
|||
do_aliases
|
||||
do_attrs
|
||||
|
||||
deduplicate_call_seq
|
||||
|
||||
@store.add_c_variables self
|
||||
|
||||
@top_level
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue