るりまサーチ

最速Rubyリファレンスマニュアル検索!
29件ヒット [1-29件を表示] (0.075秒)
トップページ > クエリ:string[x] > クエリ:Ruby[x] > クエリ:ruby[x] > クエリ:@[x] > クエリ:alias_method[x]

別のキーワード

  1. fiddle build_ruby_platform
  2. fiddle ruby_free
  3. rbconfig ruby
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

検索結果

Module#alias_method(new, original) -> Symbol (18185.0)

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

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

//emlist[例][ruby]{
module Kernel
alias_method
:hoge, :puts # => :hoge
alias_method
"foo", :puts # => :foo
end
//}

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

* メソッド名は String または Symbol で指定します
* グローバル...
...できません。

@
param new 新しいメソッド名。String または Symbol で指定します。

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

@
return 作成したエイリアスのメソッド名を表す Symbol を返します。

@
see d:spec/def#al...
...ias

//emlist[例][ruby]{
module Kernel
alias_method
:foo, :puts
end

foo "bar" # bar
//}...

Module#alias_method(new, original) -> self (18179.0)

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

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

//emlist[例][ruby]{
module Kernel
alias_method
:hoge, :puts # => Kernel
end
//}

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

* メソッド名は String または Symbol で指定します
* グローバル変数の別名をつけることはで...
...せん。

@
param new 新しいメソッド名。String または Symbol で指定します。

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

@
return self を返します。

@
see d:spec/def#alias

//emlist[例][ruby]{
module Kernel
alias_method
:foo, :puts...

NEWS for Ruby 3.0.0 (6654.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 3.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...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 autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166

//emlist[][ruby]{...
...", "f", 3]
in [*pre, String => x, String => y, *post]
p pre #=> ["a", 1]
p x #=> "b"
p y #=> "c"
p post #=> [2, "d", "e", "f", 3]
end
//}

* Endless method definition is added. [EXPERIMENTAL]
16746

//emlist{
def square(x) = x * x
//}

* Interpolated String literals are no lo...

クラス/メソッドの定義 (600.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...hod
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* defined

===[a:class] クラス定義

//emlist[例][ruby]{
class Foo < Super
def test
# ...
end
# ...
end
//}

文法:

class 識別子 [`<' superclass ]
式..
en...
...外処理についてはd:spec/control#begin参照。

クラス定義は、識別子で指定した定数へのクラスの代入になります
(Ruby では、クラスもオブジェクトの一つで Classクラスの
インスタンスです)。

クラスが既に定義されているとき、...
...生します。

//emlist[][ruby]{
class Foo < Array
def foo
end
end

# 定義を追加(スーパークラス Array を明示的に指定しても同じ)
class Foo
def bar
end
end

# 間違ったスーパークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch...