Class: Inspec::Resources::PostgresConf
  
  
  
  Constant Summary
  
  Constants included
     from FindFiles
  FindFiles::TYPES
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  
  #extract_value
  
  
  
  
  
  
  
  
  Methods included from FileReader
  #read_file_content
  
  
  
  
  
  
  
  
  Methods included from FindFiles
  #find_files, #find_files_or_warn
  Constructor Details
  
    
  
  
    #initialize(conf_path = nil)  ⇒ PostgresConf 
  
  
  
  
    
Returns a new instance of PostgresConf.
   
 
  
  
    | 
25
26
27
28
29
30
31
32
33
34
35 | # File 'lib/resources/postgres_conf.rb', line 25
def initialize(conf_path = nil)
  @conf_path = conf_path || inspec.postgres.conf_path
  if @conf_path.nil?
    return skip_resource 'PostgreSQL conf path is not set'
  end
  @conf_dir = File.expand_path(File.dirname(@conf_path))
  @files_contents = {}
  @content = nil
  @params = nil
  read_content
end | 
 
  
 
  Dynamic Method Handling
  
    This class handles dynamic methods through the method_missing method
    
  
  
    
  
  
    #method_missing(*keys)  ⇒ Object 
  
  
  
  
    | 
54
55
56
57
58
59
60
61 | # File 'lib/resources/postgres_conf.rb', line 54
def method_missing(*keys)
  keys.shift if keys.is_a?(Array) && keys[0] == :[]
  param = value(keys)
  return nil if param.nil?
    return param[0] if param.length == 1
  param
end | 
 
  
 
  
    Instance Method Details
    
      
  
  
    #content  ⇒ Object 
  
  
  
  
    | 
37
38
39 | # File 'lib/resources/postgres_conf.rb', line 37
def content
  @content ||= read_content
end | 
 
    
      
  
  
    #params(*opts)  ⇒ Object 
  
  
  
  
    | 
41
42
43
44
45
46
47
48 | # File 'lib/resources/postgres_conf.rb', line 41
def params(*opts)
  @params || read_content
  res = @params
  opts.each do |opt|
    res = res[opt] unless res.nil?
  end
  res
end | 
 
    
      
  
  
    #to_s  ⇒ Object 
  
  
  
  
    | 
63
64
65 | # File 'lib/resources/postgres_conf.rb', line 63
def to_s
  'PostgreSQL Configuration'
end | 
 
    
      
  
  
    #value(key)  ⇒ Object 
  
  
  
  
    | 
50
51
52 | # File 'lib/resources/postgres_conf.rb', line 50
def value(key)
  (key, @params)
end |