mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Alias alias to instance methods
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6217 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
269d1e9f0d
commit
04aa9a8f7d
2 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Apr 26 21:40:09 2004 Dave Thomas <dave@pragprog.com>
|
||||||
|
|
||||||
|
* lib/rdoc/code_objects.rb (RDoc::Context::add_alias): Only alias
|
||||||
|
to instance methods.
|
||||||
|
|
||||||
Sun Apr 25 18:26:23 2004 WATANABE Hirofumi <eban@ruby-lang.org>
|
Sun Apr 25 18:26:23 2004 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* configure.in (ac_cv_func_fork): set to no on DJGPP.
|
* configure.in (ac_cv_func_fork): set to no on DJGPP.
|
||||||
|
|
|
@ -195,7 +195,7 @@ module RDoc
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_alias(an_alias)
|
def add_alias(an_alias)
|
||||||
meth = find_method_named(an_alias.old_name)
|
meth = find_instance_method_named(an_alias.old_name)
|
||||||
if meth
|
if meth
|
||||||
new_meth = AnyMethod.new(an_alias.text, an_alias.new_name)
|
new_meth = AnyMethod.new(an_alias.text, an_alias.new_name)
|
||||||
new_meth.is_alias_for = meth
|
new_meth.is_alias_for = meth
|
||||||
|
@ -380,6 +380,11 @@ module RDoc
|
||||||
@method_list.find {|meth| meth.name == name}
|
@method_list.find {|meth| meth.name == name}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Find a named instance method, or return nil
|
||||||
|
def find_instance_method_named(name)
|
||||||
|
@method_list.find {|meth| meth.name == name && !meth.singleton}
|
||||||
|
end
|
||||||
|
|
||||||
# Find a named constant, or return nil
|
# Find a named constant, or return nil
|
||||||
def find_constant_named(name)
|
def find_constant_named(name)
|
||||||
@constants.find {|m| m.name == name}
|
@constants.find {|m| m.name == name}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue