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
|
||||
|
||||
def arch
|
||||
@platform.arch
|
||||
@platform.arch if @platform.respond_to?(:arch)
|
||||
end
|
||||
|
||||
def families
|
||||
|
@ -56,16 +56,16 @@ module Inspec::Resources
|
|||
end
|
||||
|
||||
def params
|
||||
# rubocop:disable Layout/AlignHash
|
||||
h = {
|
||||
name: name,
|
||||
name: name,
|
||||
families: families,
|
||||
release: release,
|
||||
release: release,
|
||||
arch: arch,
|
||||
}
|
||||
# rubocop:enable Layout/AlignHash
|
||||
|
||||
# Avoid adding Arch for APIs (not applicable)
|
||||
unless in_family?("api")
|
||||
h[:arch] = arch
|
||||
end
|
||||
h.delete :arch if in_family?("api") # not applicable if api
|
||||
|
||||
h
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue