33件ヒット
[1-33件を表示]
(0.033秒)
種類
- 文書 (22)
- インスタンスメソッド (11)
ライブラリ
- ビルトイン (11)
クラス
- Module (11)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 0 . 0 (4) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
Module
# alias _ method(new , original) -> Symbol (39131.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 (39125.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
//}... -
クラス/メソッドの定義 (124.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...クラス/メソッドの定義
* クラス/メソッドの定義:
* class
* singleton_class
* module
* method
* operator
* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* d......うな場合は外側は普通モジュールが利用される
# (Net のインスタンスがない。Net を include できるなどのため)
module Net
class HTTP
end
class FTP
end
end
obj = Net::HTTP.new
# あるいは
include Net
obj = HTTP.new
# 以下のような使い方は組......メソッド
呼び出し等の一切の評価は行われません。
メソッドの定義内で別名を付けるにはModuleクラスのメソッド
Module#alias_method を利用して下さい。
別名を付けられたメソッドは、その時点でのメソッド定義を引き継
ぎ、... -
NEWS for Ruby 3
. 0 . 0 (102.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...is now a SyntaxError instead of a LocalJumpError. 15575
* When a class variable is overtaken by the same definition in an
ancestor class/module, a RuntimeError is now raised (previously,
it only issued a warning in verbose mode). Additionally, accessing a
class variable from the t......* Module
* Module#include and Module#prepend now affect classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes included or prepended the receiver. 9573
* Module#pu......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 returns the defined alias as a symbol. 17314
//emlist[][ruby]{
class C; end
module M1; end
module M2; end
C.i... -
NEWS for Ruby 2
. 5 . 0 (60.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...thod#callを呼び出します 14142
* Module
* Module#attr, Module#attr_accessor, Module#attr_reader, Module#attr_writer はパブリックメソッドになりました 14132
* Module#define_method, Module#alias_method, Module#undef_method, Module#remove_method はパブリックメソ...