-
-
Save pdtpatrick/f87e1a880190b09015ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
class MyClass | |
def testing | |
@var = 10 | |
my_method | |
self | |
end | |
def my_method | |
@var = @var + 1 | |
end | |
end | |
# this works | |
puts MyClass.instance_methods(false) | |
#how can I do the same here | |
c = MyClass.new | |
c.instance_methods(false) # => this does not work | |
c.methods.grep(/^my/) # => sure this works but not what I want. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment