I have a function that returns a User or nil if it can't find the user. It looks like this:
# Given an access token in the HTTP headers, it returns the User who owns the token
#
# @return [User] the user who owns the access token
def set_api_user
token = /(.*)=\"(.*)\"/.match(request.headers["Authorization"])[2]
@api_user = ApiKey.find_by(access_token: token).user
end
My question is, how do I document that it returns a User or nil if it can't find it?