module JamfRubyExtensions::Array::Utils
Useful monkey patches for Array
Public Instance Methods
j_ci_fetch(somestring)
click to toggle source
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
@param somestring [String] the String
to search for
@return [String, nil] The matching string as it exists in the Array
,
nil if it doesn't exist
# File lib/jamf/ruby_extensions/array/utils.rb 43 def j_ci_fetch(somestring) 44 each { |s| return s if s.respond_to?(:casecmp?) && s.casecmp?(somestring) } 45 nil 46 end
Also aliased as: jss_ci_fetch_string