How to check if array includes string element?
address = 'London is a capital of GB'
def get_location(address)
all_cities = ['Amsterdam','Moscow','Krakow','London']
city = all_cities.index {|x| x.match /address/ }
if city
return all_cities[city]
else
address
end
end
but its returns me full address
I needs to return the city's name from string