Skip to content

Instantly share code, notes, and snippets.

@apeiros
Created August 19, 2018 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apeiros/cd6b5b9861998c6b247c82e53dfc7d59 to your computer and use it in GitHub Desktop.
Save apeiros/cd6b5b9861998c6b247c82e53dfc7d59 to your computer and use it in GitHub Desktop.
def sources(klass)
(
klass.methods(false).map { |name| klass.method(name).source_location&.first } |
klass.instance_methods(false).map { |name| klass.instance_method(name)&.source_location.first }
).compact
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment