diff options
| author | mo khan <mo@mokhan.ca> | 2024-05-24 11:09:18 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2024-05-24 11:09:18 -0600 |
| commit | 1e70e58c3d2507e12e9f14efa7b1f82c50571d93 (patch) | |
| tree | 43ebc9beca5337af7b838b476da13ed12d19d6f3 /bin | |
| parent | a6c6a9d5b2d3253c30f4c7a2f7f965c220f8ca8b (diff) | |
collapse methods
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/community | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/community b/bin/community index cf0e6b3..d7fab48 100755 --- a/bin/community +++ b/bin/community @@ -174,13 +174,15 @@ class Community @row[COLUMNS[name]] || @row.fetch(name.to_s.upcase) end - def create_directory_in(root_dir) - FileUtils.mkdir_p("#{root_dir}/#{name.parameterize}", verbose: true) + def create_content_in(root_dir) + target_dir = "#{root_dir}/#{name.parameterize}" + FileUtils.mkdir_p(target_dir, verbose: true) + create_readme_in(target_dir) end - def create_readme + def create_readme_in(dir) erb = ERB.new(IO.read("templates/community.md.erb")) - IO.write("yyc/#{name.parameterize}/README.md", erb.result(binding)) + IO.write("#{dir}/README.md", erb.result(binding)) end end @@ -201,8 +203,5 @@ end Census .new("data/Census_by_Community_2019_20240524.csv") .find_all { |x| x[:class].include?("Residential") } - .each do |community| - community.create_directory_in("yyc") - community.create_readme - end + .each { |x| x.create_content_in("yyc") } |
