Skip to content

Instantly share code, notes, and snippets.

@rotelstift
Last active March 15, 2016 14:38
Show Gist options
  • Save rotelstift/71f36d14aaee08dc8363 to your computer and use it in GitHub Desktop.
Save rotelstift/71f36d14aaee08dc8363 to your computer and use it in GitHub Desktop.
obj1 = Object.new
def obj1.singleton_method_added(n)
p n
end
def obj1.new_singleton_method
end
# => :singleton_method_added
# => :new_singleton_method
class Object
def singleton_method_added(n)
p n
end
end
obj2 = Object.new
def obj2.new_singleton_method
end
# => :new_singleton_method
str = String.new
def str.singleton_method_added(n)
p n
end
def str.new_singleton_method
end
# => :singleton_method_added
# => :new_singleton_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment