以下の内容はhttps://tbpgr.hatenablog.com/entry/20140720/1405868075より取得しました。


Ruby | Module | include?

概要

include?(mod) -> bool

詳細

self かその親クラス / 親モジュールがモジュール mod を インクルードしていれば true を返却。

サンプルコード
require 'tbpgr_utils'

module Hogeable;end

class Hoge
  include Hogeable
end

class Hige
end

bulk_puts_eval binding, <<-EOS
Hoge.include? Hogeable
Hige.include? Hogeable
EOS

__END__
下記はTbpgrUtils gemの機能
bulk_puts_eval

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils

出力

出力

Hoge.include? Hogeable # => true
Hige.include? Hogeable # => false



以上の内容はhttps://tbpgr.hatenablog.com/entry/20140720/1405868075より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14