Last active
December 20, 2015 01:49
-
-
Save pinzolo/6051873 to your computer and use it in GitHub Desktop.
クラスがモジュールを extend したかどうかを取得する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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