Class: Inspec::Resources::AuditDaemonConf

Inherits:
Object
  • Object
show all
Includes:
FileReader
Defined in:
lib/inspec/resources/auditd_conf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FileReader

#read_file_content

Constructor Details

#initialize(path = nil) ⇒ AuditDaemonConf

Returns a new instance of AuditDaemonConf.



21
22
23
24
# File 'lib/inspec/resources/auditd_conf.rb', line 21

def initialize(path = nil)
  @conf_path = path || "/etc/audit/auditd.conf"
  @content = read_file_content(@conf_path)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



26
27
28
# File 'lib/inspec/resources/auditd_conf.rb', line 26

def method_missing(name)
  read_params[name.to_s]
end

Instance Attribute Details

#conf_pathObject (readonly)

Returns the value of attribute conf_path.



19
20
21
# File 'lib/inspec/resources/auditd_conf.rb', line 19

def conf_path
  @conf_path
end

#contentObject (readonly)

Returns the value of attribute content.



19
20
21
# File 'lib/inspec/resources/auditd_conf.rb', line 19

def content
  @content
end

#paramsObject (readonly)

Returns the value of attribute params.



19
20
21
# File 'lib/inspec/resources/auditd_conf.rb', line 19

def params
  @params
end

Instance Method Details

#resource_idObject



30
31
32
# File 'lib/inspec/resources/auditd_conf.rb', line 30

def resource_id
  @conf_path || "auditd_conf"
end

#to_sObject



34
35
36
# File 'lib/inspec/resources/auditd_conf.rb', line 34

def to_s
  "Audit Daemon Config"
end