るりまサーチ

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

別のキーワード

  1. singleton clone
  2. singleton dup
  3. singleton instance
  4. object define_singleton_method
  5. _builtin define_singleton_method

検索結果

Object#singleton_class -> Class (18131.0)

レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。

... nil か true か false なら、それぞれ NilClass, TrueClass,
FalseClass を返します。

@raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。

//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class #...
...=> #<Class:String>
nil
.singleton_class #=> NilClass
//}

@see Object#class...

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

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

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

文法:

class...
...n参照。

特異クラス定義式は、最後に評価した式の結果を返します。最後に評価した式
が値を返さない場合は nil を返します。

===[a:module] モジュール定義

//emlist[例][ruby]{
module Foo
def test
# ...
end
# ...
end
//}

文法:...

Ruby用語集 (48.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...持つ。

https://mruby.org/

: main
トップレベルにおける self。Object クラスのインスタンスである。

===[a:N] N

: nil
Nil
Class の唯一のインスタンス。また、そのオブジェクトを指す擬似変数の名前。
論理値としては偽である。...
...ーバーとメソッド名を結ぶ演算子の一つ「&.」。
「.」と違う点は、レシーバーが nil のとき引数の評価もメソッド呼び出しも行わずに nil
返す、ということだけである。
Ruby 2.3 で導入された。
俗に「ぼっち演算子...
...自身が属すクラスとは別に、オブジェクト固有の
クラスがあり、特異クラスと呼ばれる。

参照:Object#singleton_class

: 特異メソッド
: singleton method
オブジェクト固有のメソッド。
オブジェクトの特異クラスのインスタ...

NEWS for Ruby 2.1.0 (12.0)

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

...数の虚部が有理数になる
42ri # => Complex(0, 42r)
3.14ri # => Complex(0, 3.14r)
//}

* def によるメソッド定義式は nil の代わりにメソッド名をシンボルで返します

=== 組み込みクラスの更新

* Array
* 追加: Array#to_h キーと値の...
...: Module#using, which activates refinements of the specified module only
in the current class or module definition.
* 追加: Module#singleton_class? レシーバーが特異クラスであれば true を返します。
レシーバーが通常のクラスやモジュールであれ...

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12.0)

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or  plus minus ast slash hat sq  period comma langl rangl eq tilde  dollar at under lbrarbra  lbra2rbra2 lbra3rbra3 dq colon ac  backslash semicolon

...をブロックとして使う。d:spec/call#block を参照。

: xxx&.yyy

safe navigation operator(通称「ぼっち演算子」)。xxx が nil でないときにメソッドyyyを呼び出す。spec/call を参照。

===[a:or] |

: 3 | 5

論理和演算子または類似のメソッド...
...クラス定義でスーパークラスを指定しています。
d:spec/def#class。

: class << obj

特異クラス定義。d:spec/def#singleton_classを参照。

===[a:rangl] >

: 3 > 5

「より大きい」比較演算子

: 3 >= 5

「より大きいか等しい」比較演算子

: 3...

絞り込み条件を変える