Improve method privacy

This commit is contained in:
Adam Hoyle 2021-08-24 21:27:43 +01:00
parent 94f9c2b86f
commit 0a3b052cf6

View file

@ -7,7 +7,10 @@ class Communities
@local_chapters[locale] = local_chapter_for(locale)
end
def self.local_chapter_for(locale)
class << self
protected
def local_chapter_for(locale)
@local_chapters_index = load_local_chapters
locale_dict = locale_dict_for(locale)
localised_chapters = []
@ -20,7 +23,7 @@ class Communities
localised_chapters
end
def self.load_local_chapters
def load_local_chapters
json_file = File.expand_path("node_modules/osm-community-index/dist/resources.json", Dir.pwd)
community_index = JSON.parse(File.read(json_file))
local_chapters = []
@ -37,7 +40,7 @@ class Communities
local_chapters
end
def self.locale_dict_for(locale_in)
def locale_dict_for(locale_in)
locale = locale_in.to_s.tr("-", "_")
full_local_path = File.expand_path("node_modules/osm-community-index/i18n/#{locale}.yaml", Dir.pwd)
locale_dict = {}
@ -53,3 +56,4 @@ class Communities
locale_dict
end
end
end