Skip to content

Instantly share code, notes, and snippets.

@pinzolo
Last active December 20, 2015 01:49
Show Gist options
  • Save pinzolo/6051873 to your computer and use it in GitHub Desktop.
Save pinzolo/6051873 to your computer and use it in GitHub Desktop.
クラスがモジュールを extend したかどうかを取得する
module Foo
end
class Bar
extend Foo
end
Bar.included_modules.include?(Foo)
Bar.include?(Foo)
# => false
(class << Bar self end).included_modules.include?(Foo)
Bar.singleton_class.include?(Foo)
# => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment