Skip to content

Commit

Permalink
Fix warning on nil comparison
Browse files Browse the repository at this point in the history
This uses the more efficient /regex/.match?(value) syntax that also
doesn't raise any warning if id is nil.
  • Loading branch information
ekohl authored and chris1984 committed Jan 6, 2025
1 parent 4c62859 commit d971ad5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fog/vsphere/compute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def managed_obj_id(obj)
end

def is_uuid?(id)
!(id =~ /[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/).nil?
/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}/.match?(id)
end
end

Expand Down

0 comments on commit d971ad5

Please sign in to comment.