Inline type annotations for User.
This commit is contained in:
parent
fc7a34585f
commit
059122c724
@ -1,11 +0,0 @@
|
||||
# typed: strict
|
||||
|
||||
class User < SimpleDelegator
|
||||
include Kernel
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def gui?; end
|
||||
|
||||
sig { returns(T.nilable(T.attached_class)) }
|
||||
def self.current; end
|
||||
end
|
||||
@ -10,7 +10,11 @@ require "system_command"
|
||||
#
|
||||
# @api private
|
||||
class User < SimpleDelegator
|
||||
include Kernel
|
||||
extend T::Sig
|
||||
|
||||
# Return whether the user has an active GUI session.
|
||||
sig { returns(T::Boolean) }
|
||||
def gui?
|
||||
out, _, status = system_command "who"
|
||||
return false unless status.success?
|
||||
@ -21,6 +25,7 @@ class User < SimpleDelegator
|
||||
end
|
||||
|
||||
# Return the current user.
|
||||
sig { returns(T.nilable(T.attached_class)) }
|
||||
def self.current
|
||||
return @current if defined?(@current)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user