Class: Inspec::Resources::Passwd
- Inherits:
-
Object
- Object
- Inspec::Resources::Passwd
- Includes:
- PasswdParser
- Defined in:
- lib/resources/passwd.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#lines ⇒ Object
readonly
Returns the value of attribute lines.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(path = nil, opts = nil) ⇒ Passwd
constructor
A new instance of Passwd.
- #to_s ⇒ Object
- #uid(x) ⇒ Object
Methods included from PasswdParser
#parse_passwd, #parse_passwd_line
Constructor Details
#initialize(path = nil, opts = nil) ⇒ Passwd
Returns a new instance of Passwd.
45 46 47 48 49 50 51 |
# File 'lib/resources/passwd.rb', line 45 def initialize(path = nil, opts = nil) opts ||= {} @path = path || '/etc/passwd' @content = opts[:content] || inspec.file(@path).content @lines = @content.to_s.split("\n") @params = parse_passwd(@content) end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
42 43 44 |
# File 'lib/resources/passwd.rb', line 42 def content @content end |
#lines ⇒ Object (readonly)
Returns the value of attribute lines.
43 44 45 |
# File 'lib/resources/passwd.rb', line 43 def lines @lines end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
41 42 43 |
# File 'lib/resources/passwd.rb', line 41 def params @params end |
Instance Method Details
#to_s ⇒ Object
93 94 95 |
# File 'lib/resources/passwd.rb', line 93 def to_s '/etc/passwd' end |
#uid(x) ⇒ Object
86 87 88 89 |
# File 'lib/resources/passwd.rb', line 86 def uid(x) warn '[DEPRECATION] `passwd.uid(arg)` is deprecated. Please use `passwd.uids(arg)` instead. It will be removed in version 1.0.0.' uids(x) end |