improvement: simplify readability of nil checks

This commit is contained in:
Christoph Hartmann 2015-09-15 16:05:35 +02:00 committed by Dominik Richter
parent db81929dd7
commit 341a4ba98d
8 changed files with 8 additions and 12 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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