class Inspec::Resources::NtpConf

def initialize(path = nil)

def initialize(path = nil)
  @conf_path = path || '/etc/ntp.conf'
  @content = read_file_content(@conf_path)
end

def method_missing(name)

def method_missing(name)
  param = read_params[name.to_s]
  # extract first value if we have only one value in array
  return param[0] if param.is_a?(Array) and param.length == 1
  param
end

def read_params

def read_params
  return @params if defined?(@params)
  # parse the file
  conf = SimpleConfig.new(
    @content,
    assignment_regex: /^\s*(\S+)\s+(.*)\s*$/,
    multiple_values: true,
  )
  @params = conf.params
end

def to_s

def to_s
  'ntp.conf'
end