Skip to content

Instantly share code, notes, and snippets.

@pdtpatrick
Created September 24, 2012 05:43
Show Gist options
  • Save pdtpatrick/f87e1a880190b09015ac to your computer and use it in GitHub Desktop.
Save pdtpatrick/f87e1a880190b09015ac to your computer and use it in GitHub Desktop.
#!/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