るりまサーチ

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

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. string end_with?

ライブラリ

クラス

検索結果

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

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

...ct#extendやModule#prepend
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に false を返します。

@param mod クラスやモジュールなど、Moduleかそのサブクラスのインスタンスです。

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

Rake::FileList#kind_of?(klass) -> bool (18113.0)

自身に Array のフリをさせます。

...自身に Array のフリをさせます。

//emlist[][ruby]{
# Rakefile での記載例とする

t
ask default: :test_rake_app
t
ask :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
file_list.is_a?(Array) # => true
file_list.is_a?(String) # => false
end

//}...