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_comment_line, #parse_passwd, #parse_passwd_line
Constructor Details
#initialize(path = nil) ⇒ Passwd
Returns a new instance of Passwd.
38
39
40
41
42
|
# File 'lib/resources/passwd.rb', line 38
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.
36
37
38
|
# File 'lib/resources/passwd.rb', line 36
def parsed
@parsed
end
|
#uid(uid) ⇒ Object
call passwd().uid(0) returns a seperate object with reference to this object
46
47
48
|
# File 'lib/resources/passwd.rb', line 46
def uid
@uid
end
|
Instance Method Details
#gids ⇒ Object
62
63
64
|
# File 'lib/resources/passwd.rb', line 62
def gids
map_data('gid')
end
|
#passwords ⇒ Object
54
55
56
|
# File 'lib/resources/passwd.rb', line 54
def passwords
map_data('password')
end
|
#to_s ⇒ Object
66
67
68
|
# File 'lib/resources/passwd.rb', line 66
def to_s
'/etc/passwd'
end
|
#uids ⇒ Object
58
59
60
|
# File 'lib/resources/passwd.rb', line 58
def uids
map_data('uid')
end
|
#usernames ⇒ Object
50
51
52
|
# File 'lib/resources/passwd.rb', line 50
def usernames
map_data('name')
end
|