Class: PasswdUid

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/passwd.rb

Overview

object that hold a specifc uid view on passwd

Instance Method Summary collapse

Constructor Details

#initialize(passwd, uid) ⇒ PasswdUid

Returns a new instance of PasswdUid.



88
89
90
91
# File 'lib/resources/passwd.rb', line 88

def initialize(passwd, uid)
  @passwd = passwd
  @users = @passwd.parsed.select { |x| x['uid'] == uid.to_s }
end

Instance Method Details

#countObject



97
98
99
# File 'lib/resources/passwd.rb', line 97

def count
  @users.size
end

#usernameObject



93
94
95
# File 'lib/resources/passwd.rb', line 93

def username
  @users.at(0)['name']
end