Class: Passwd
Instance Attribute Summary collapse
-
#parsed ⇒ Object
readonly
Returns the value of attribute parsed.
-
#uid(uid) ⇒ Object
readonly
call passwd().uid(0) returns a seperate object with reference to this object.
Instance Method Summary
collapse
#parse_passwd, #parse_passwd_line
Constructor Details
#initialize(path = nil) ⇒ Passwd
Returns a new instance of Passwd.
45
46
47
48
49
|
# File 'lib/resources/passwd.rb', line 45
def initialize(path = nil)
@path = path || '/etc/passwd'
@content = inspec.file(@path).content
@parsed = parse_passwd(@content)
end
|
Instance Attribute Details
#parsed ⇒ Object
Returns the value of attribute parsed.
43
44
45
|
# File 'lib/resources/passwd.rb', line 43
def parsed
@parsed
end
|
#uid(uid) ⇒ Object
call passwd().uid(0) returns a seperate object with reference to this object
53
54
55
|
# File 'lib/resources/passwd.rb', line 53
def uid
@uid
end
|
Instance Method Details
#gids ⇒ Object
69
70
71
|
# File 'lib/resources/passwd.rb', line 69
def gids
map_data('gid')
end
|
#passwords ⇒ Object
61
62
63
|
# File 'lib/resources/passwd.rb', line 61
def passwords
map_data('password')
end
|
#to_s ⇒ Object
73
74
75
|
# File 'lib/resources/passwd.rb', line 73
def to_s
'/etc/passwd'
end
|
#uids ⇒ Object
65
66
67
|
# File 'lib/resources/passwd.rb', line 65
def uids
map_data('uid')
end
|
#usernames ⇒ Object
57
58
59
|
# File 'lib/resources/passwd.rb', line 57
def usernames
map_data('name')
end
|