lib/rdoc/any_method.rb in rdoc-3.6.1 vs lib/rdoc/any_method.rb in rdoc-3.7
- old
+ new
@@ -4,11 +4,11 @@
##
# AnyMethod is the base class for objects representing methods
class RDoc::AnyMethod < RDoc::MethodAttr
- MARSHAL_VERSION = 0 # :nodoc:
+ MARSHAL_VERSION = 1 # :nodoc:
##
# Don't rename \#initialize to \::new
attr_accessor :dont_rename_initialize
@@ -42,21 +42,21 @@
end
##
# Adds +an_alias+ as an alias for this method in +context+.
- def add_alias(an_alias, context = nil )
+ def add_alias an_alias, context = nil
method = self.class.new an_alias.text, an_alias.new_name
method.record_location an_alias.file
method.singleton = self.singleton
method.params = self.params
method.visibility = self.visibility
method.comment = an_alias.comment
method.is_alias_for = self
@aliases << method
- context.add_method( method ) if context
+ context.add_method method if context
method
end
##
# Prefix for +aref+ is 'method'.
@@ -81,11 +81,11 @@
##
# Dumps this AnyMethod for use by ri. See also #marshal_load
def marshal_dump
aliases = @aliases.map do |a|
- [a.full_name, parse(a.comment)]
+ [a.name, parse(a.comment)]
end
[ MARSHAL_VERSION,
@name,
full_name,
@@ -94,10 +94,11 @@
parse(@comment),
@call_seq,
@block_params,
aliases,
@params,
+ @file.absolute_name,
]
end
##
# Loads this AnyMethod from +array+. For a loaded AnyMethod the following
@@ -110,29 +111,33 @@
@dont_rename_initialize = nil
@is_alias_for = nil
@token_stream = nil
@aliases = []
+ version = array[0]
@name = array[1]
@full_name = array[2]
@singleton = array[3]
@visibility = array[4]
@comment = array[5]
@call_seq = array[6]
@block_params = array[7]
+
+ array[8].each do |new_name, comment|
+ add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
+ end
+
@params = array[9]
@parent_name = if @full_name =~ /#/ then
$`
else
name = @full_name.split('::')
name.pop
name.join '::'
end
- array[8].each do |new_name, comment|
- add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
- end
+ @file = RDoc::TopLevel.new array[10] if version > 0
end
##
# Method name
#