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.

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top