maybe.. I’m just personally biased against ternary operator ;)

could also be something like:

    return username if name.blank?
    name.strip.gsub(/\s.*$/, '') # "first name"

to emphasize that shortening name is the ‘normal’ behavior and using username is the fallback