Class: Goz::User::EtcPasswd
Overview
Goz::User::EtcPasswd - /etc/passwd
derived users (mostly for testing)
Usage
TODO
Author
blair christensen. <[email protected]>
Homepage
Constant Summary collapse
- TAG =
self.name
Instance Attribute Summary
Attributes inherited from Base
#email, #identifier, #klass, #login, #name
Class Method Summary collapse
-
.find_by_login(login) ⇒ Object
Find Goz::User by login or return
nil
.
Instance Method Summary collapse
-
#initialize(u) ⇒ EtcPasswd
constructor
A new instance of EtcPasswd.
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.find_by_login(login) Goz::Logger.debug TAG, "find_by_login( login=#{login} )" begin return self.new( Etc.getpwnam(login) ) rescue ArgumentError => e Goz::Logger.warn TAG, "find_by_login( login=#{login} ) - not found" end nil end |