Class: Goz::User::EtcPasswd

Inherits:
Base
  • Object
show all
Defined in:
lib/goz/user/etc_passwd.rb

Overview

Goz::User::EtcPasswd - /etc/passwd derived users (mostly for testing)

Usage

TODO

Author

blair christensen. <[email protected]>

Homepage

github.com/blairc/goz/

Constant Summary collapse

TAG =
self.name

Instance Attribute Summary

Attributes inherited from Base

#email, #identifier, #klass, #login, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], configuration, #to_hash, #to_s

Constructor Details

#initialize(u) ⇒ EtcPasswd

Returns a new instance of EtcPasswd.



31
32
33
34
35
36
37
# File 'lib/goz/user/etc_passwd.rb', line 31

def initialize(u)
  @email      = "#{ u[:name] }@#{ Socket.gethostname }" # TODO Hack!
  @identifier = u[:uid].to_s
  @klass      = self.class.name
  @login      = u[:name]
  @name       = u[:gecos]
end

Class Method Details

.find_by_login(login) ⇒ Object

Find Goz::User by login or return nil



42
43
44
45
46
47
48
49
50
# File 'lib/goz/user/etc_passwd.rb', line 42

def self.()
  Goz::Logger.debug TAG, "find_by_login( login=#{} )"
  begin
    return self.new( Etc.getpwnam() )
  rescue ArgumentError => e
    Goz::Logger.warn TAG, "find_by_login( login=#{} ) - not found"
  end
  nil
end