Skip to content

Instantly share code, notes, and snippets.

@nirvdrum
Created July 28, 2015 19:28
Show Gist options
  • Save nirvdrum/21d239cddc526767166a to your computer and use it in GitHub Desktop.
Save nirvdrum/21d239cddc526767166a to your computer and use it in GitHub Desktop.
class A
# There is Kernel#public_method, so we don't want this one to clash
def pub_method; :public_method; end
def undefed_method; :undefed_method; end
undef_method :undefed_method
protected
def protected_method; :protected_method; end
private
def private_method; :private_method; end
public
define_method(:defined_method) { :defined }
end
p A.new.respond_to?(:protected_method, false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment