るりまサーチ

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

別のキーワード

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

検索結果

<< 1 2 > >>

Object#singleton_class -> Class (24238.0)

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

...します。

@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...

Module#singleton_class? -> bool (12238.0)

self が特異クラスの場合に true を返します。そうでなければ false を返し ます。

...self が特異クラスの場合に true を返します。そうでなければ false を返し
ます。

//emlist[例][ruby]{
class C
end
C.singleton_class? # => false
C.singleton_class.singleton_class? # => true
//}...

VALUE rb_singleton_class(VALUE obj) (12200.0)

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

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

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

VALUE rb_singleton_class_clone(VALUE klass) (12200.0)

特異クラス klass を clone して返します。 klass が特異クラスでないときはただ klass を返します。

特異クラス klass を clone して返します。
klass が特異クラスでないときはただ klass を返します。

VALUE rb_singleton_class_new(VALUE super) (12200.0)

super をスーパークラスとする特異クラスを生成し、返します。

super をスーパークラスとする特異クラスを生成し、返します。

絞り込み条件を変える

void rb_singleton_class_attached(VALUE klass, VALUE obj) (12200.0)

特異クラス klass にその唯一のインスタンス obj を結びつけます。

特異クラス klass にその唯一のインスタンス obj を結びつけます。

クラス/メソッドの定義 (66.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
//}...
...# <- foo は未定義
def foo
print "foo\n"
end
//}

は未定義メソッドの呼び出しで例外 NameError を発生させます。

===[a:singleton_method] 特異メソッド定義

//emlist[例][ruby]{
def foo.test
print "this is foo\n"
end
//}

文法:

def 式 `.' 識別子 [`...

NEWS for Ruby 2.1.0 (42.0)

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

...

* Kernel
* 追加: Kernel#singleton_method(Object#singleton_method)

* Module
* 追加: Module#using, which activates refinements of the specified module only
in the current class or module definition.
* 追加: Module#singleton_class? レシーバーが特異クラスで...
...* 特異クラスの祖先はそれ自身を含みます。
The ancestors of a singleton class now include singleton classes,
in particular itself.

* Module#define_method Object#define_singleton_method
* 定義したメソッドの名前をシンボルで返すようになり...

Module#private_class_method(*name) -> self (24.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。

...@param name 0 個以上の String または Symbol を指定します。

//emlist[例][ruby]{
module Foo
def self.foo; end
end

Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...
...mes 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
module Foo
def self.foo; end
end

Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...

Module#private_class_method(names) -> self (24.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。

...mes 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
module Foo
def self.foo; end
end

Foo.singleton_class.private_method_defined?(:foo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...

絞り込み条件を変える

<< 1 2 > >>