Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/mixlib/install/backend/bintray.rb

Overview

Add method to Array class to support searching for substrings that match against the items in the Array

Instance Method Summary collapse

Instance Method Details

#fuzzy_include?(search_value, regex_format = "%s") ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
32
33
# File 'lib/mixlib/install/backend/bintray.rb', line 29

def fuzzy_include?(search_value, regex_format = "%s")
  inject(false) do |is_found, array_value|
    is_found || !!(search_value =~ /#{regex_format % array_value}/)
  end
end