Sha256: 23f8486430890c510b775768e9b0fda39eda7289d3520cebba34046051668fad

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

require 'sys/admin'

module MagicReveal
  # figures out the author's identity
  class Identifier
    attr_accessor :sys_admin

    def initialize(sys_admin = nil)
      @sys_admin = sys_admin || Sys::Admin
    end

    # Alias to make life easier.
    def self.name
      new.name
    end

    def name
      login = sys_admin.get_login
      user = sys_admin.get_user login

      return user.full_name if user.respond_to? :full_name
      gecos = user.gecos
      name = gecos.split(/\s*,\s*/).first
      if name.nil? || name.empty?
        return login
      else
        return name
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
magic_reveal-2.6.1.4 lib/magic_reveal/identifier.rb