mirror of
https://github.com/inspec/inspec
synced 2025-02-17 06:28:40 +00:00
improvement: simplify readability of nil checks
This commit is contained in:
parent
db81929dd7
commit
341a4ba98d
8 changed files with 8 additions and 12 deletions
|
@ -28,7 +28,7 @@ class AuditDaemonConf < Vulcano.resource(1)
|
|||
|
||||
def method_missing(name)
|
||||
@params || read_content
|
||||
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||
@params.nil? ? nil : @params[name.to_s]
|
||||
end
|
||||
|
||||
def read_content
|
||||
|
|
|
@ -31,8 +31,7 @@ class GemPackage < Vulcano.resource(1)
|
|||
end
|
||||
|
||||
def version
|
||||
return nil if info.nil?
|
||||
info[:version]
|
||||
info.nil? ? nil : info[:version]
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -29,7 +29,7 @@ class InetdConf < Vulcano.resource(1)
|
|||
|
||||
def method_missing(name)
|
||||
@params || read_content
|
||||
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||
@params.nil? ? nil : @params[name.to_s]
|
||||
end
|
||||
|
||||
def read_content
|
||||
|
|
|
@ -27,7 +27,7 @@ class LimitsConf < Vulcano.resource(1)
|
|||
|
||||
def method_missing(name)
|
||||
@params || read_content
|
||||
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||
@params.nil? ? nil : @params[name.to_s]
|
||||
end
|
||||
|
||||
def read_content
|
||||
|
|
|
@ -33,7 +33,7 @@ class LoginDef < Vulcano.resource(1)
|
|||
|
||||
def method_missing(name)
|
||||
@params || read_content
|
||||
!@params.nil? ? (return @params[name.to_s]) : (return nil)
|
||||
@params.nil? ? nil : @params[name.to_s]
|
||||
end
|
||||
|
||||
def read_content
|
||||
|
|
|
@ -29,8 +29,7 @@ class NpmPackage < Vulcano.resource(1)
|
|||
end
|
||||
|
||||
def version
|
||||
return nil if info.nil?
|
||||
info[:version]
|
||||
info.nil? ? nil : info[:version]
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -38,8 +38,7 @@ class OneGetPackage < Vulcano.resource(1)
|
|||
end
|
||||
|
||||
def version
|
||||
return nil if info.nil?
|
||||
info[:version]
|
||||
info.nil? ? nil : info[:version]
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
|
@ -33,8 +33,7 @@ class PipPackage < Vulcano.resource(1)
|
|||
end
|
||||
|
||||
def version
|
||||
return nil if info.nil?
|
||||
info[:version]
|
||||
info.nil? ? nil : info[:version]
|
||||
end
|
||||
|
||||
def to_s
|
||||
|
|
Loading…
Add table
Reference in a new issue