Question

Is there a convention to indicate that a parameter in YARD style documentation is only used for its "truthiness" status, that is you only want to know if it's false or nil or is truthy?

What is typically put in place of Truthy in the following?

# @param [String] name
# @param [Truthy] admin_status 
def create_user(name, admin_status)
  # code goes here
end

The closest I can find in the documentation is Boolean, which isn't really what I want.

Was it helpful?

Solution

Using anything other than Boolean would imply that you're doing some sort of special handling, like interpreting 0 as false or something less literal than true/false checking.

You can see the convention used in the YARD docs where "Boolean" means evaluates as true/false.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top