class Inspec::Resources::LimitsConf

Public Class Methods

new(path = nil) click to toggle source
# File lib/inspec/resources/limits_conf.rb, line 19
def initialize(path = nil)
  @conf_path = path || "/etc/security/limits.conf"
  @content = read_file_content(@conf_path)
end

Public Instance Methods

method_missing(name) click to toggle source
# File lib/inspec/resources/limits_conf.rb, line 24
def method_missing(name)
  read_params[name.to_s]
end
read_params() click to toggle source
# File lib/inspec/resources/limits_conf.rb, line 28
def read_params
  return @params if defined?(@params)

  # parse the file
  conf = SimpleConfig.new(
    @content,
    assignment_regex: /^\s*(\S+?)\s+(.*?)\s+(.*?)\s+(.*?)\s*$/,
    key_values: 3,
    multiple_values: true
  )
  @params = conf.params
end
to_s() click to toggle source
# File lib/inspec/resources/limits_conf.rb, line 41
def to_s
  "limits.conf"
end