Created
December 22, 2014 00:52
-
-
Save k2works/d8f38c9caa99c67de8c1 to your computer and use it in GitHub Desktop.
特異クラス
This file contains 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
class OriginalClass | |
end | |
obj = OriginalClass.new | |
def obj.new_singleton_method | |
:new_singleton_method | |
end | |
obj.class.method_defined? :new_singleton_method # => false | |
obj.singleton_class.method_defined? :new_singleton_method # => true | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment