12

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

Jamie Cook
  • 4,375
  • 3
  • 42
  • 53
  • should the method be public? it seems like as a 'side-effect' only other methods might call on it therefore it doesn't need to be a public method... – Anthony Sep 08 '14 at 00:31
  • Since Ruby methods usually return the return value of the latest expression, I am kind of interested how your method looks likes like. – spickermann Sep 08 '14 at 00:45
  • Yes this method should be public as it is the only user accessible entry point into a class (the ruby runs from within a container program and this class imports user-specified data into that program) – Jamie Cook Sep 09 '14 at 03:07
  • @spickermann - the method actually does return nil ... but I want the documentation to indicate that the method is not intended for returning a value (rather for performing the side effect) – Jamie Cook Sep 09 '14 at 03:08

1 Answers1

13

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

G. Allen Morris III
  • 1,012
  • 18
  • 30