diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/community | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/community b/bin/community index 305195d..84cf0bd 100755 --- a/bin/community +++ b/bin/community @@ -42,6 +42,10 @@ class Community @row.fetch(key.to_s.upcase) end + def <=>(other) + self.name <=> other.name + end + def create_content_in(root_dir) target_dir = "#{root_dir}/#{name.parameterize}" FileUtils.mkdir_p(target_dir, verbose: true) @@ -68,9 +72,16 @@ class Census yield Community.new(row) end end + + def create_content_in(dir) + erb = ERB.new(IO.read("templates/communities.md.erb"), trim_mode: "-") + IO.write("#{dir}/README.md", erb.result(binding)) + + find_all { |x| x[:class].include?("Residential") } + .each { |x| x.create_content_in(dir) } + end end Census .new("data/Census_by_Community_2019_20240524.csv") - .find_all { |x| x[:class].include?("Residential") } - .each { |x| x.create_content_in("yyc") } + .create_content_in("yyc") |
