るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.051秒)
トップページ > クエリ:nil[x] > クエリ:attr_accessor[x] > クエリ:クラス/メソッドの定義[x]

別のキーワード

  1. クラス/メソッドの定義
  2. クラス/メソッドの定義 proc
  3. クラス/メソッドの定義 class
  4. クラス
  5. クラス/メソッドの定義 module

検索結果

クラス/メソッドの定義 (15139.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...
...た式の結果を返します。最後に評価した式
が値を返さない場合は nil を返します。

===[a:singleton_class] 特異クラス定義

//emlist[例][ruby]{
obj = Object.new # obj = nil でも可
class << obj
def test
# ...
end
# ...
end
//}

文法:

class...
...可能な演算子(例: ==, +, -
など spec/operator を参照)も指定できます(operator参照)。

//emlist[例][ruby]{
class Vector2D
attr_accessor
:x, :y # インスタンス変数@x, @yに対応するゲッタとセッタを定義
def initialize(x, y) # コンストラクタ
@x...