Skip to content

Instantly share code, notes, and snippets.

@jarrettmeyer
Created February 20, 2013 14:48
Show Gist options
  • Save jarrettmeyer/4996029 to your computer and use it in GitHub Desktop.
Save jarrettmeyer/4996029 to your computer and use it in GitHub Desktop.
class X
def do_something
'**PUBLIC**'
end
private
def do_something_privately
'--private--'
end
end
> x = X.new
> x.do_something # => **PUBLIC**
> x.do_something_privately # => NoMethodError: private method do_something_privately
> x.instance_eval { do_something_privately } # => --private--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment