Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
While I was in here... nothing big.

It does seem like we have too many hard-coded symbols in our code in
general as well as too many symbol styles (underscore vs dash).

Signed-off-by: Ryan Davis <zenspider@chef.io>
  • Loading branch information
zenspider committed Jun 19, 2019
1 parent 598c594 commit de2ebba
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions lib/inspec/resources/platform.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,22 @@ def supported?(supports)
return true if supports.nil? || supports.empty?

status = true
supports.each do |s|
s.each do |k, v|
if %i{os_family os-family platform_family platform-family}.include?(k)
status = in_family?(v)
elsif %i{os platform}.include?(k)
status = platform?(v)
elsif %i{os_name os-name platform_name platform-name}.include?(k)
status = name == v
elsif k == :release
status = check_release(v)
else
status = false
end
supports.each do |support|
support.each do |k, v|
status =
case k
when :os_family, :"os-family", :platform_family, :"platform-family" then
in_family?(v)
when :os, :platform then
platform?(v)
when :os_name, :"os-name", :platform_name, :"platform-name" then
name == v
when :release then
check_release(v)
else
false
end

break if status == false
end
return true if status == true
Expand Down

0 comments on commit de2ebba

Please sign in to comment.