Module: User
Overview
Some user related helper methods
Instance Method Summary collapse
-
#name ⇒ Object
Get the current user taking into account sudo priviledges.
-
#root? ⇒ Boolean
Check if the current user has root privileges.
Instance Method Details
#name ⇒ Object
Get the current user taking into account sudo priviledges
35 36 37 |
# File 'lib/nub/user.rb', line 35 def name return Process.uid.zero? ? Etc.getpwuid(ENV['SUDO_UID'].to_i).name : ENV['USER'] end |
#root? ⇒ Boolean
Check if the current user has root privileges
30 31 32 |
# File 'lib/nub/user.rb', line 30 def root? return Process.uid.zero? end |