Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change return value of Module#alias_method #2462

Merged
merged 4 commits into from
Feb 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions refm/api/src/_builtin/Module.alias_method
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
#@since 3.0.0
--- alias_method(new, original) -> Symbol
#@else
--- alias_method(new, original) -> self
#@end

メソッドの別名を定義します。

#@samplecode 例
#@since 3.0.0
module Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end
#@else
module Kernel
alias_method :hoge, :puts # => Kernel
end
#@end
#@end

alias との違いは以下の通りです。

* メソッド名は [[c:String]] または [[c:Symbol]] で指定します
Expand All @@ -13,6 +30,12 @@ alias との違いは以下の通りです。

@param original 元のメソッド名。[[c:String]] または [[c:Symbol]] で指定します。

#@since 3.0.0
@return 作成したエイリアスのメソッド名を表す [[c:Symbol]] を返します。
#@else
@return self を返します。
#@end

@see [[ref:d:spec/def#alias]]

例:
Expand Down