Class: Inspec::Resources::PostgresConf
- Inherits:
-
Object
- Object
- Inspec::Resources::PostgresConf
show all
- Includes:
- FindFiles
- Defined in:
- lib/resources/postgres_conf.rb
Constant Summary
Constants included
from FindFiles
FindFiles::TYPES
Instance Method Summary
collapse
Methods included from FindFiles
#find_files, #find_files_or_error
Constructor Details
#initialize(conf_path = nil) ⇒ PostgresConf
Returns a new instance of PostgresConf.
23
24
25
26
27
28
29
30
|
# File 'lib/resources/postgres_conf.rb', line 23
def initialize(conf_path = nil)
@conf_path = conf_path || inspec.postgres.conf_path
@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(name) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/resources/postgres_conf.rb', line 45
def method_missing(name)
param = params[name.to_s]
return nil if param.nil?
return param[0] if param.length == 1
param
end
|
Instance Method Details
#content ⇒ Object
32
33
34
|
# File 'lib/resources/postgres_conf.rb', line 32
def content
@content ||= read_content
end
|
#params(*opts) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/resources/postgres_conf.rb', line 36
def params(*opts)
@params || read_content
res = @params
opts.each do |opt|
res = res[opt] unless res.nil?
end
res
end
|
#to_s ⇒ Object
53
54
55
|
# File 'lib/resources/postgres_conf.rb', line 53
def to_s
'PostgreSQL Configuration'
end
|