mirror of
https://github.com/inspec/inspec
synced 2024-11-23 21:23:29 +00:00
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:
parent
aef285a1f6
commit
10cb92da48
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue