The Crystal Programming Language Forum

Getting all available methods for a type in a macro

Is there a way to get all instance methods that can be called on a type? There is TypeNode#methods - which will return the methods defined in that type, but it omits methods from any included modules or superclasses.

I could traverse the #ancestors and call #methods on each of them, but this seems messy.

Is there a cleaner way to do this?

1 Like