るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

検索結果

<< < 1 2 3 4 ... > >>

Module#singleton_class? -> bool (6119.0)

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

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

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

Object#singleton_class -> Class (6119.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...

VALUE rb_obj_singleton_methods(int argc, VALUE *argv, VALUE obj) (6116.0)

Object#singleton_methods の実体。 オブジェクト obj に定義されている特異メソッド名のリストを 文字列の配列で返す。

...Object#singleton_methods の実体。
オブジェクト obj に定義されている特異メソッド名のリストを
文字列の配列で返す。...

Object#define_singleton_method(symbol) { ... } -> Symbol (6114.0)

self に特異メソッド name を定義します。

...t[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"

guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}...

Object#define_singleton_method(symbol, method) -> Symbol (6114.0)

self に特異メソッド name を定義します。

...t[][ruby]{
class A
class << self
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"

guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}...

絞り込み条件を変える

Object#singleton_method(name) -> Method (6113.0)

オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。

..."Hello, @iv = #{@iv}"
end
end

k = Demo.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:hello) # => NameError
//}

@see Module#instance_method, Method, BasicObject#__send__...

VALUE rb_singleton_class(VALUE obj) (6100.0)

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

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

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

VALUE rb_singleton_class_clone(VALUE klass) (6100.0)

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

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

VALUE rb_singleton_class_new(VALUE super) (6100.0)

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

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

void rb_define_singleton_method(VALUE obj, const char *name, VALUE (*func)(), int argc) (6100.0)

obj に特異メソッド name を定義します。 メソッドの実体を func に関数ポインタで与え、その関数がとる 引数のタイプを argc に渡します。argc のフォーマットに ついては rb_define_method の記述を参照してください。

obj に特異メソッド name を定義します。
メソッドの実体を func に関数ポインタで与え、その関数がとる
引数のタイプを argc に渡します。argc のフォーマットに
ついては rb_define_method の記述を参照してください。

絞り込み条件を変える

<< < 1 2 3 4 ... > >>