improve reliability of method_missing

This commit is contained in:
Christoph Hartmann 2015-09-09 00:07:08 +01:00 committed by Dominik Richter
parent 05dd53b5b4
commit c081cfac82
6 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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