From 932fb816db21035cb5fe30dce06538d84fdeb045 Mon Sep 17 00:00:00 2001 From: Cadu Ribeiro Date: Wed, 22 Nov 2023 17:57:53 -0300 Subject: [PATCH] Use << to add missing city to the list Instead of using `@cities[country][state] = new_value`, use `<<` to add the missing city into the cities list --- lib/city-state.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/city-state.rb b/lib/city-state.rb index b8cb30e..bcaa4df 100644 --- a/lib/city-state.rb +++ b/lib/city-state.rb @@ -181,7 +181,7 @@ def self.cities(state, country = nil) else index = @cities[country][state].index(old_value) if index.nil? - @cities[country][state][] = new_value + @cities[country][state] << new_value else @cities[country][state][index] = new_value end