Unrolled Code

07·10·2026

The other day I was looking at a little project called grubby, a minimal static site generator for git repos, written in Ruby. The style is quite interesting. It feels solid and unapologetic:

def fill_template(template, page_title, root_prefix)
  template
    .gsub("{{title}}", escape_html(page_title))
    .gsub("{{root}}", root_prefix)
    .gsub("{{stylesheet}}") { STYLESHEET }
    .gsub("{{build_date}}", BUILD_DATE)
end

Nothing is particularly optimized, it just uses available tools to do its work:

def write_page(page_path, page_title, root_prefix = "")
  FileUtils.mkdir_p(File.dirname(page_path))
  header = fill_template(HEADER_TEMPLATE, page_title, root_prefix)
  footer = fill_template(FOOTER_TEMPLATE, page_title, root_prefix)
  File.write(page_path, header + yield + footer)
end