るりまサーチ

最速Rubyリファレンスマニュアル検索!
121件ヒット [101-121件を表示] (0.106秒)

別のキーワード

  1. _builtin include?
  2. socket mcast_include
  3. dbm include?
  4. sdbm include?
  5. gdbm include?

ライブラリ

検索結果

<< < 1 2 >>

Object#kind_of?(mod) -> bool (14.0)

オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。

...をインクルードしたクラスかそのサブクラス
のインスタンスである場合にも真を返します。
Module#includeだけではなく、Object#extendやModule#prependに
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでも...
...です。

//emlist[][ruby]{
module M
end
class C < Object
include
M
end
class S < C
end

obj = S.new
p obj.is_a?(S) # true
p obj.is_a?(C) # true
p obj.is_a?(Object) # true
p obj.is_a?(M) # true
p obj.is_a?(Hash) # false
//}

@see Object#instance_of?,Module#===,Object#class...

Object#singleton_methods(inherited_too = true) -> [Symbol] (8.0)

そのオブジェクトに対して定義されている特異メソッド名 (public あるいは protected メソッド) の一覧を返します。

...た特異メソッドとは Object#extend によって追加された特異メソッドや、
self がクラスの場合はスーパークラスのクラスメソッド(Classのインスタンスの特異メソッド)などです。

singleton_methods(false) は、Object#methods(false) と同じで...
...Bar
private; def private_bar() end
protected; def protected_bar() end
public; def public_bar() end
end

obj = Foo.new
class <<obj
include
Bar
private; def private_self() end
protected; def protected_self() end
public; def public_self() end
end

# あるオブジェ...
...ラスのクラスメソッドも含まれるよう true を指定したが、
# Object のクラスメソッドは一覧から排除している。

p obj.singleton_methods(true)
p Foo.singleton_methods(true) - Object.singleton_methods(true)

#実行結果

[:protected_self, :public_self, :protecte...
<< < 1 2 >>