Skip to content

Instantly share code, notes, and snippets.

@etdebruin
Created December 28, 2011 20:48
Show Gist options
  • Save etdebruin/1529662 to your computer and use it in GitHub Desktop.
Save etdebruin/1529662 to your computer and use it in GitHub Desktop.
Finding all methods
class A
def a
true
end
end
class B
def a
true
end
end
ObjectSpace.each_object(Class) do |k|
k.instance_methods.each do |m|
if m.to_s == 'a'
puts k.name
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment