Class: Inspec::Resources::AideConf
- Inherits:
-
Object
- Object
- Inspec::Resources::AideConf
- Includes:
- CommentParser, FileReader
- Defined in:
- lib/resources/aide_conf.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #all_have_rule(rule) ⇒ Object
-
#initialize(aide_conf_path = nil) ⇒ AideConf
constructor
A new instance of AideConf.
Methods included from FileReader
Methods included from CommentParser
Constructor Details
#initialize(aide_conf_path = nil) ⇒ AideConf
Returns a new instance of AideConf.
31 32 33 34 35 36 |
# File 'lib/resources/aide_conf.rb', line 31 def initialize(aide_conf_path = nil) @conf_path = aide_conf_path || '/etc/aide.conf' @content = nil @rules = nil read_content end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
26 27 28 |
# File 'lib/resources/aide_conf.rb', line 26 def params @params end |
Instance Method Details
#all_have_rule(rule) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/resources/aide_conf.rb', line 38 def all_have_rule(rule) # Case when file didn't exist or perms didn't allow an open return false if @content.nil? lines = @params.reject { |line| line['rules'].include? rule } lines.empty? end |