Clean up Platform#params.

State your normal case first, then deal with edge cases, not the other
way around.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-12-26 13:59:50 -08:00
parent aef285a1f6
commit 10cb92da48

View file

@ -27,7 +27,7 @@ module Inspec::Resources
end end
def arch def arch
@platform.arch @platform.arch if @platform.respond_to?(:arch)
end end
def families def families
@ -56,16 +56,16 @@ module Inspec::Resources
end end
def params def params
# rubocop:disable Layout/AlignHash
h = { h = {
name: name, name: name,
families: families, families: families,
release: release, release: release,
arch: arch,
} }
# rubocop:enable Layout/AlignHash
# Avoid adding Arch for APIs (not applicable) h.delete :arch if in_family?("api") # not applicable if api
unless in_family?("api")
h[:arch] = arch
end
h h
end end