mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Import RDoc 3.5.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
918f625a5e
commit
cc2a16d94d
49 changed files with 2119 additions and 273 deletions
|
@ -13,6 +13,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|||
|
||||
attr_accessor :dont_rename_initialize
|
||||
|
||||
##
|
||||
# The C function that implements this method (if it was defined in a C file)
|
||||
|
||||
attr_accessor :c_function
|
||||
|
||||
##
|
||||
# Different ways to call this method
|
||||
|
||||
|
@ -31,8 +36,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|||
def initialize text, name
|
||||
super
|
||||
|
||||
@c_function = nil
|
||||
@dont_rename_initialize = false
|
||||
@token_stream = nil
|
||||
@token_stream = nil
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -140,12 +146,41 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|||
end
|
||||
|
||||
##
|
||||
# Pretty parameter list for this method
|
||||
# A list of this method's method and yield parameters. +call-seq+ params
|
||||
# are preferred over parsed method and block params.
|
||||
|
||||
def param_list
|
||||
if @call_seq then
|
||||
params = @call_seq.split("\n").last
|
||||
params = params.sub(/.*?\((.*)\)/, '\1')
|
||||
params = params.sub(/(\{|do)\s*\|([^|]*)\|.*/, ',\2')
|
||||
elsif @params then
|
||||
params = @params.sub(/\((.*)\)/, '\1')
|
||||
|
||||
params << ",#{@block_params}" if @block_params
|
||||
elsif @block_params then
|
||||
params = @block_params
|
||||
else
|
||||
return []
|
||||
end
|
||||
|
||||
params.gsub(/\s+/, '').split ','
|
||||
end
|
||||
|
||||
##
|
||||
# Pretty parameter list for this method. If the method's parameters were
|
||||
# given by +call-seq+ it is preferred over the parsed values.
|
||||
|
||||
def param_seq
|
||||
params = @params.gsub(/\s*\#.*/, '')
|
||||
params = params.tr("\n", " ").squeeze(" ")
|
||||
params = "(#{params})" unless params[0] == ?(
|
||||
if @call_seq then
|
||||
params = @call_seq.split("\n").last
|
||||
params = params.sub(/[^( ]+/, '')
|
||||
params = params.sub(/(\|[^|]+\|)\s*\.\.\.\s*(end|\})/, '\1 \2')
|
||||
else
|
||||
params = @params.gsub(/\s*\#.*/, '')
|
||||
params = params.tr("\n", " ").squeeze(" ")
|
||||
params = "(#{params})" unless params[0] == ?(
|
||||
end
|
||||
|
||||
if @block_params then
|
||||
# If this method has explicit block parameters, remove any explicit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue