Skip to content

Instantly share code, notes, and snippets.

@aereal
Created June 7, 2010 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aereal/428470 to your computer and use it in GitHub Desktop.
Save aereal/428470 to your computer and use it in GitHub Desktop.
class Greeting
def hello; end
private do
def bonjour; end
end
protected do
def guten_morgen; end
end
end
klass = Class.new
Greeting.public_instance_methods - klass.public_instance_methods # => ["hello"]
Greeting.private_instance_methods - klass.private_instance_methods # => ["bonjour"]
Greeting.protected_instance_methods - klass.protected_instance_methods # => ["guten_morgen"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment