Method: JamfRubyExtensions::Array::Utils#j_ci_fetch
- Defined in:
- lib/jamf/ruby_extensions/array/utils.rb
#j_ci_fetch(somestring) ⇒ String? Also known as: jss_ci_fetch_string
Fetch a string from an Array case-insensitively, e.g. if my_array contains ‘thrasher’,
my_array.j_ci_fetch('ThRashEr')
will return ‘thrasher’
returns nil if no match
25 26 27 28 |
# File 'lib/jamf/ruby_extensions/array/utils.rb', line 25 def j_ci_fetch(somestring) each { |s| return s if s.respond_to?(:casecmp?) && s.casecmp?(somestring) } nil end |