diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-10-28 09:47:30 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-10-28 09:47:30 -0700 |
commit | 5b54538e22189fea3ba05539fde67a60638194d0 (patch) | |
tree | 0c7217a77a88d1f46319b9d80e73489defa39029 | |
parent | 24cb7c539e852ca13c535cdf0d9624b5d5f770da (diff) | |
download | chef-5b54538e22189fea3ba05539fde67a60638194d0.tar.gz |
Remove .nil? and add some yard explaining what this method is
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r-- | chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb b/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb index 05188d44aa..533db85860 100644 --- a/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb +++ b/chef-config/lib/chef-config/mixin/fuzzy_hostname_matcher.rb @@ -20,8 +20,16 @@ module ChefConfig module Mixin module FuzzyHostnameMatcher + # + # Check to see if a hostname matches a match string. Used to see if hosts fall under our no_proxy config + # + # @param [String] hostname the hostname to check + # @param [String] matches the pattern to match + # + # @return [Boolean] + # def fuzzy_hostname_match_any?(hostname, matches) - unless hostname.nil? || matches.nil? + if hostname && matches return matches.to_s.split(/\s*,\s*/).compact.any? do |m| fuzzy_hostname_match?(hostname, m) end |