class ISO3166::Country
def find_all_by(attribute, val)
def find_all_by(attribute, val) raise "Invalid attribute name '#{attribute}'" unless AttrReaders.include?(attribute.to_sym) attribute = ['name', 'names'] if attribute == 'name' Data.select do |k,v| Array(attribute).map do |attr| if v[attr].kind_of?(Enumerable) v[attr].map{ |n| n.downcase }.include?(val) else v[attr] && v[attr].downcase == val end end.uniq.include?(true) end end