Module: PerUserStatus::Patches::UserPatch

Extended by:
ActiveSupport::Concern
Defined in:
lib/per_user_status/patches/user_patch.rb

Overview

Patches the User#name method to allow injecting the current user status

Instance Method Summary collapse

Instance Method Details

#name_with_custom_status(formatter = nil) ⇒ Object

Appends the custom user status to the base user name

Parameters:

  • formatter (defaults to: nil)

    The formatter to use for the name

See Also:

  • User#name


16
17
18
19
20
21
22
23
# File 'lib/per_user_status/patches/user_patch.rb', line 16

def name_with_custom_status(formatter = nil)
  default = name_without_custom_status(formatter)
  if custom_status.present?
    "#{default} (#{custom_status})"
  else
    default
  end
end