<commit_before># frozen_string_literal: true

require "delegate"
require "etc"

require "system_command"

class User < DelegateClass(String)
  def gui?
    out, _, status = system_command "who"
    return false unless status.success?

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

  def self.current
    return @current if defined?(@current)

    pwuid = Etc.getpwuid(Process.euid)
    return if pwuid.nil?

    @current = new(pwuid.name)
  end
end<commit_msg>Document `User`.<commit_after># frozen_string_literal: true

require "delegate"
require "etc"

require "system_command"

# A system user.
#
# @api private
class User < DelegateClass(String)
  # Return whether the user has an active GUI session.
  def gui?
    out, _, status = system_command "who"
    return false unless status.success?

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

  # Return the current user.
  def self.current
    return @current if defined?(@current)

    pwuid = Etc.getpwuid(Process.euid)
    return if pwuid.nil?

    @current = new(pwuid.name)
  end
end
{'fraction_non_alphanumeric': 0.11693895098882201, 'fraction_numerical': 0.0, 'mean_word_length': 3.2021660649819497, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4126386', 'n_tokens_mistral': 397, 'n_tokens_neox': 383, 'n_words': 112}