thecodecrate / city-state

Simple ruby gem to create form lists with cities and states
MIT License
306 stars 135 forks source link

Use << to add missing city to the list #66

Open duduribeiro opened 9 months ago

duduribeiro commented 9 months ago

Hey folks đŸ‘‹

I'm using ruby 3.2.2 and having a issue when adding a missing city. I added this yml to my project: db/cities-lookup.yml

BR:
  GO:
    "MutunĂ³polis": "MutunĂ³polis"

but when I run

CS.cities(:go, :br)

to test it fails for me because:

/Users/cadu/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/city-state-1.1.0/lib/city-state.rb:185:in `[]=': wrong number of arguments (given 1, expected 2..3) (ArgumentError)

              @cities[country][state][] = new_value

I think the idea of this line is to add a new_value to the existing array, so I changed it to include the new line

duduribeiro commented 6 months ago

hey @loureirorg đŸ‘‹

Just pinging to check if this one and https://github.com/thecodecrate/city-state/pull/68 are valids. Just wanted a bump of version so I can use this instead of a fork đŸ˜„

Thanks!