Jamie Cook
Jamie Cook

Reputation: 4535

How to YARD document a method that returns nothing

I have a method like this

def self.import(file_name, opts = {})

which I'm trying to document with YARD. However this is a method which is 100% side effect (I know, I know, side effects, urgh!). But for users of this method there is effectively no returned object of any type, however YARD generates a signature like this:

+ (Object) import(file_name, opts = {})

Is there any way to tell yard that the import method returns nothing?

I can tell it to return nil, but that's not really the same thing

Upvotes: 12

Views: 3379

Answers (1)

G. Allen Morris III
G. Allen Morris III

Reputation: 1042

All methods return something, the void key word might be what you are looking for.

# @return [void]
def method_returning_unknown_object
end

void return rendering

Upvotes: 13

Related Questions