diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-18 23:33:36 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-18 23:33:36 +0000 |
commit | df7dac9174a31e71b58be6184e23bfe6b742a494 (patch) | |
tree | 885edf624f0e8f37014b0d937340ac1c372a0066 /lib/rdoc/any_method.rb | |
parent | fed428007c015ac3b7f4586f2491517fafffa030 (diff) |
* 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
Diffstat (limited to 'lib/rdoc/any_method.rb')
-rw-r--r-- | lib/rdoc/any_method.rb | 52 |
1 files changed, 48 insertions, 4 deletions
diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb index 23110dcb2a..3afafc86b8 100644 --- a/lib/rdoc/any_method.rb +++ b/lib/rdoc/any_method.rb @@ -9,8 +9,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr # Added calls_super # Added parent name and class # Added section title + # 3:: + # RDoc 4.1 + # Added is_alias_for - MARSHAL_VERSION = 2 # :nodoc: + MARSHAL_VERSION = 3 # :nodoc: ## # Don't rename \#initialize to \::new @@ -25,7 +28,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr ## # Different ways to call this method - attr_accessor :call_seq + attr_reader :call_seq ## # Parameters for this method @@ -90,6 +93,37 @@ class RDoc::AnyMethod < RDoc::MethodAttr end ## + # Sets the different ways you can call this method. If an empty +call_seq+ + # is given nil is assumed. + # + # See also #param_seq + + def call_seq= call_seq + return if call_seq.empty? + + @call_seq = call_seq + end + + ## + # Loads is_alias_for from the internal name. Returns nil if the alias + # cannot be found. + + def is_alias_for # :nodoc: + case @is_alias_for + when RDoc::MethodAttr then + @is_alias_for + when Array then + return nil unless @store + + klass_name, singleton, method_name = @is_alias_for + + return nil unless klass = @store.find_class_or_module(klass_name) + + @is_alias_for = klass.find_method method_name, singleton + end + end + + ## # Dumps this AnyMethod for use by ri. See also #marshal_load def marshal_dump @@ -97,6 +131,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr [a.name, parse(a.comment)] end + is_alias_for = [ + @is_alias_for.parent.full_name, + @is_alias_for.singleton, + @is_alias_for.name + ] if @is_alias_for + [ MARSHAL_VERSION, @name, full_name, @@ -112,6 +152,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr @parent.name, @parent.class, @section.title, + is_alias_for, ] end @@ -126,7 +167,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr initialize_visibility @dont_rename_initialize = nil - @is_alias_for = nil @token_stream = nil @aliases = [] @parent = nil @@ -150,6 +190,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr @parent_name = array[12] @parent_title = array[13] @section_title = array[14] + @is_alias_for = array[15] array[8].each do |new_name, comment| add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton) @@ -174,7 +215,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr def name return @name if @name - @name = @call_seq[/^.*?\.(\w+)/, 1] || @call_seq if @call_seq + @name = + @call_seq[/^.*?\.(\w+)/, 1] || + @call_seq[/^.*?(\w+)/, 1] || + @call_seq if @call_seq end ## |