るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.019秒)
トップページ > クエリ:TypeError[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 (18125.0)

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

...lseClass を返します。

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

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

@see Ob...

VALUE rb_singleton_class(VALUE obj) (6106.0)

obj に特異クラスを導入し、その特異クラスを返します。 すでに特異クラスが導入されているときはそれをそのまま返します。

...bj に特異クラスを導入し、その特異クラスを返します。
すでに特異クラスが導入されているときはそれをそのまま返します。

obj が特異メソッドを定義できない型のオブジェクトである
ときは例外 TypeError を発生します。...

クラス/メソッドの定義 (34.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...
...定義を書くとク
ラスの定義の追加になります。
ただし、元のクラスと異なるスーパークラスを指定すると TypeError が発生します。

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

# 定義を追加(スーパークラス Array を明示的に指...
...def bar
end
end

# 間違ったスーパークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch for class Foo (TypeError)
//}

クラス定義式の中は self がそのクラスであることと、
limitのデフォルトが異なること以外
にトップレ...

NEWS for Ruby 2.1.0 (12.0)

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

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

* Numeric#quo
* レシーバーが to_r メソッドを持たないとき ArgumentError ではなく TypeError を発生させるようになりました。

* Proc
* Returning from lambda proc now always exits from the Proc, not from the
metho...