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.



81
82
83
84
# File 'lib/resources/passwd.rb', line 81

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

Instance Method Details

#countObject



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

def count
  @users.size
end

#usernameObject



86
87
88
# File 'lib/resources/passwd.rb', line 86

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