種類
- 文書 (25)
- インスタンスメソッド (24)
- 関数 (12)
- 特異メソッド (12)
ライブラリ
- ビルトイン (12)
-
irb
/ extend-command (24)
クラス
- Module (12)
モジュール
キーワード
-
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (5) -
install
_ alias _ method (12) -
irb
_ original _ method _ name (12) -
rb
_ mod _ alias _ method (12) - クラス/メソッドの定義 (12)
検索結果
先頭5件
- Module
# alias _ method(new , original) -> Symbol - Module
# alias _ method(new , original) -> self - IRB
:: ExtendCommandBundle # install _ alias _ method(to , from , override = NO _ OVERRIDE) - static VALUE rb
_ mod _ alias _ method(VALUE mod , VALUE newname , VALUE oldname) - IRB
:: ExtendCommandBundle . irb _ original _ method _ name(method _ name) -> String
-
Module
# alias _ method(new , original) -> Symbol (24225.0) -
メソッドの別名を定義します。
...メソッドの別名を定義します。
//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => :hoge
alias_method "foo", :puts # => :foo
end
//}
alias との違いは以下の通りです。
* メソッド名は String または Symbol で指定します
* グローバル......ます。
@param original 元のメソッド名。String または Symbol で指定します。
@return 作成したエイリアスのメソッド名を表す Symbol を返します。
@see d:spec/def#alias
//emlist[例][ruby]{
module Kernel
alias_method :foo, :puts
end
foo "bar" # bar
//}... -
Module
# alias _ method(new , original) -> self (24219.0) -
メソッドの別名を定義します。
...メソッドの別名を定義します。
//emlist[例][ruby]{
module Kernel
alias_method :hoge, :puts # => Kernel
end
//}
alias との違いは以下の通りです。
* メソッド名は String または Symbol で指定します
* グローバル変数の別名をつけることはで......いメソッド名。String または Symbol で指定します。
@param original 元のメソッド名。String または Symbol で指定します。
@return self を返します。
@see d:spec/def#alias
//emlist[例][ruby]{
module Kernel
alias_method :foo, :puts
end
foo "bar" # bar
//}... -
IRB
:: ExtendCommandBundle # install _ alias _ method(to , from , override = NO _ OVERRIDE) (12201.0) -
メソッドのエイリアスを定義します。ライブラリ内部で使用します。
...rride 新しいメソッド名が定義済みであった場合にそのメソッドを
上書きするかどうかを
IRB::ExtendCommandBundle::NO_OVERRIDE、
IRB::ExtendCommandBundle::OVERRIDE_PRIVATE_ONLY、
IRB::ExtendCommandBundle:......:OVERRIDE_ALL のいずれか
で指定します。... -
static VALUE rb
_ mod _ alias _ method(VALUE mod , VALUE newname , VALUE oldname) (12200.0) -
-
IRB
:: ExtendCommandBundle . irb _ original _ method _ name(method _ name) -> String (6206.0) -
method_name で指定したメソッドの irb 中でのエイリアスを返します。ライブ ラリ内部で使用します。
...method_name で指定したメソッドの irb 中でのエイリアスを返します。ライブ
ラリ内部で使用します。
@param method_name メソッド名を Symbol か文字列で指定します。
@see IRB::ExtendCommandBundle#install_alias_method... -
クラス/メソッドの定義 (3108.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...odule
* method
* operator
* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* defined
===[a:class] クラス定義
//emlist[例][ruby]{
class Foo < Super
def test
# ...
end
# ...
end......ss ]
式..
end
文法:
class 識別子 [`<' superclass ]
式..
[rescue [error_type,..] [=> evar] [then]
式..]..
[else
式..]
[ensure
式..]
end
クラスを定義します。...... d:spec/literal#symbol を指定します(obj.method のよ
うな式を書くことはできません)。alias の引数はメソッド
呼び出し等の一切の評価は行われません。
メソッドの定義内で別名を付けるにはModuleクラスのメソッド
Module#alias_method... -
NEWS for Ruby 3
. 0 . 0 (18.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...語仕様の変更
* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to aut......t argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]
pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}
* Arguments forwarding (`...`) now supports leading argument......_method, toplevel "private" and "public" methods now accept single array argument with a list of method names. 17314
* Module#attr_accessor, Module#attr_reader, Module#attr_writer and Module#attr methods now return an array of defined method names as symbols. 17314
* Module#alias_method now... -
NEWS for Ruby 2
. 5 . 0 (12.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...11547
* do/end ブロック内部で rescue/else/ensure を書けるようになりました 12906
* 文字列の式展開内部の暗黙の to_s 呼び出しにも refinements が影響するようになりました 13812
=== 組み込みクラスの更新
* Array
* Array#append を追......加 12746
* Array#prepend を追加 12746
* Data
* 非推奨になりました。C拡張のベースクラスでしたが、Rubyレベルに公開するのをやめました。3072
* Exception
* Exception#full_message を追加 14141 [実験的]
例外の文字列表現を取......thod
* Method#=== は Proc#===と同じようにMethod#callを呼び出します 14142
* Module
* Module#attr, Module#attr_accessor, Module#attr_reader, Module#attr_writer はパブリックメソッドになりました 14132
* Module#define_method, Module#alias_method, Module#undef_...