Skip to content

Instantly share code, notes, and snippets.

@misfo
Created October 2, 2013 17:00
Show Gist options
  • Save misfo/6796883 to your computer and use it in GitHub Desktop.
Save misfo/6796883 to your computer and use it in GitHub Desktop.
def self.some_func
end
# now we can call this at the top-level
p some_func #=> nil
# without polluting Object
p Object.new.respond_to?(:some_func, true) #=> false
def some_object_polluting_func
end
# that also makes the method available at the top-level
p some_object_polluting_func #=> nil
# but it pollutes Object
p Object.new.respond_to?(:some_object_polluting_func, true) #=> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment