From: Andy Allan Date: Wed, 30 Mar 2022 17:03:11 +0000 (+0100) Subject: Use map rather than foo = [] ... each ... foo.push(bar) X-Git-Tag: live~1027^2~15 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d17d13c806f7833f4ab19da911f54a0e0704da5c?ds=sidebyside Use map rather than foo = [] ... each ... foo.push(bar) --- diff --git a/lib/osm_community_index/local_chapter.rb b/lib/osm_community_index/local_chapter.rb index 6df3c1bc9..f36a6441c 100644 --- a/lib/osm_community_index/local_chapter.rb +++ b/lib/osm_community_index/local_chapter.rb @@ -13,13 +13,11 @@ module OsmCommunityIndex def self.init_local_chapters raw_local_chapters = load_raw_local_chapters - local_chapters = [] - raw_local_chapters.each do |chapter| + raw_local_chapters.map do |chapter| id = chapter[:id] url = chapter[:resource]["strings"]["url"] - local_chapters.push(LocalChapter.new(id, url)) + LocalChapter.new(id, url) end - local_chapters end def self.load_raw_local_chapters