mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
improve reliability of method_missing
This commit is contained in:
parent
05dd53b5b4
commit
c081cfac82
6 changed files with 6 additions and 4 deletions
|
@ -28,7 +28,7 @@ class AuditDaemonConf < Vulcano.resource(1)
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
@params || read_content
|
@params || read_content
|
||||||
@params[name.to_s]
|
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_content
|
def read_content
|
||||||
|
|
|
@ -29,7 +29,7 @@ class InetdConf < Vulcano.resource(1)
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
@params || read_content
|
@params || read_content
|
||||||
@params[name.to_s]
|
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_content
|
def read_content
|
||||||
|
|
|
@ -27,7 +27,7 @@ class LimitsConf < Vulcano.resource(1)
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
@params || read_content
|
@params || read_content
|
||||||
@params[name.to_s]
|
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_content
|
def read_content
|
||||||
|
|
|
@ -33,7 +33,7 @@ class LoginDef < Vulcano.resource(1)
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
@params || read_content
|
@params || read_content
|
||||||
@params[name.to_s]
|
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
def read_content
|
def read_content
|
||||||
|
|
|
@ -28,6 +28,7 @@ class NtpConf < Vulcano.resource(1)
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
@params || read_content
|
@params || read_content
|
||||||
|
return nil if @params.nil?
|
||||||
param = @params[name.to_s]
|
param = @params[name.to_s]
|
||||||
# extract first value if we have only one value in array
|
# extract first value if we have only one value in array
|
||||||
param = param[0] if !param.nil? && param.length == 1
|
param = param[0] if !param.nil? && param.length == 1
|
||||||
|
|
|
@ -31,6 +31,7 @@ class SshConf < Vulcano.resource(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def method_missing(name)
|
def method_missing(name)
|
||||||
|
return nil if @params.nil?
|
||||||
param = @params[name.to_s]
|
param = @params[name.to_s]
|
||||||
# extract first value if we have only one value in array
|
# extract first value if we have only one value in array
|
||||||
param = param[0] if !param.nil? && param.length == 1
|
param = param[0] if !param.nil? && param.length == 1
|
||||||
|
|
Loading…
Reference in a new issue