Class: Inspec::Resources::SshConf
- Inherits:
-
Object
- Object
- Inspec::Resources::SshConf
show all
- Defined in:
- lib/resources/ssh_conf.rb
Instance Method Summary
collapse
Constructor Details
#initialize(conf_path = nil, type = nil) ⇒ SshConf
Returns a new instance of SshConf.
19
20
21
22
23
|
# File 'lib/resources/ssh_conf.rb', line 19
def initialize(conf_path = nil, type = nil)
@conf_path = conf_path || '/etc/ssh/ssh_config'
typename = (@conf_path.include?('sshd') ? 'Server' : 'Client')
@type = type || "SSH #{typename} configuration #{conf_path}"
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/resources/ssh_conf.rb', line 35
def method_missing(name)
param = read_params[name.to_s]
return nil if param.nil?
return param[0] if param.length == 1
param
end
|
Instance Method Details
#content ⇒ Object
25
26
27
|
# File 'lib/resources/ssh_conf.rb', line 25
def content
read_content
end
|
#params(*opts) ⇒ Object
29
30
31
32
33
|
# File 'lib/resources/ssh_conf.rb', line 29
def params(*opts)
opts.inject(read_params) do |res, nxt|
res.respond_to?(:key) ? res[nxt] : nil
end
end
|
#to_s ⇒ Object
43
44
45
|
# File 'lib/resources/ssh_conf.rb', line 43
def to_s
'SSH Configuration'
end
|