Class: User

Inherits:
String show all
Defined in:
brew/Library/Homebrew/utils/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from String

#chuzzle, #f, #undent

Class Method Details

.currentObject



18
19
20
# File 'brew/Library/Homebrew/utils/user.rb', line 18

def self.current
  @current ||= new(Etc.getpwuid(Process.euid).name)
end

Instance Method Details

#gui?Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
# File 'brew/Library/Homebrew/utils/user.rb', line 9

def gui?
  out, _, status = system_command "who"
  return false unless status.success?

  out.lines
     .map(&:split)
     .any? { |user, type,| user == self && type == "console" }
end