yard-contracts
yard-contracts copied to clipboard
Class methods showing up as instance methods
Doing the following doesn't work as expected.
class Foo
include Contracts
class << self
Contract String => Num
def foo(a)
1
end
end
end
Shows the method as an instance method.
The current check for whether it's a class or instance method is very simplistic based on there being a self.
so this other syntax doesn't work. YARD / Ripper don't (that I could find) provide a way to automatically see if a method is class or instance, hence the need for this hack.
I don't really know what to do to fix it. I don't particularly want to add even bigger hacks for all the edge cases. If you can find an elegant way to do it though I'm open to a pull request.