Skip to content

Instantly share code, notes, and snippets.

@k2works
Created December 22, 2014 00:52
Show Gist options
  • Save k2works/d8f38c9caa99c67de8c1 to your computer and use it in GitHub Desktop.
Save k2works/d8f38c9caa99c67de8c1 to your computer and use it in GitHub Desktop.
特異クラス
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