module ISO3166::CountryClassMethods
def collect_likely_countries_by_subdivision_name(subdivision_str, result_method = :itself)
-
(Array)
- An array of countries with subdivisions matching the provided name, or the result of applying `result_method` to the array of `Country` objects
Parameters:
-
result_method
(Symbol
) -- An optional method of `Country` to apply to the result set. -
subdivision_str
(String
) -- A subdivision name or code to search for. Search includes translated subdivision names.
def collect_likely_countries_by_subdivision_name(subdivision_str, result_method = :itself) return nil unless method_defined? result_method all.select { |country| country.subdivision_for_string?(subdivision_str) } .map { |country| country.send(result_method) } end