Home > Mobile >  YARD convention for "any" object as a parameter
YARD convention for "any" object as a parameter

Time:06-04

How to document a YARD parameter that could be of any type possible?

Is there a convention for it?

This is similar to Any type in TypeScript

# @param [?] var1
def create_foo(var1)
  # var1 could be anything
end

CodePudding user response:

Since almost every object in Ruby inherits behavior from the class Object, # @param [Object] var1 seems like an appropriate choice.

A few examples from rubygems/rubygems and lostisland/faraday

  • Related