Sha256: 7280736af20438d7c9f01c74e6babb59d88fe86b63c84ad5e0f1cca94675406d
Contents?: true
Size: 554 Bytes
Versions: 3
Compression:
Stored size: 554 Bytes
Contents
# frozen_string_literal: true class PageBuilder ROOT = Pages::ApplicationPage def self.build_all ROOT.subclasses.each { |page| new(page).call } end def initialize(page) @page = page end def call FileUtils.mkdir_p(directory) File.write(file, @page.new.call) end private def file "#{directory}/index.html" end def directory if path == "index" "#{__dir__}/dist" else "#{__dir__}/dist/#{path}" end end def path @page.name.split("::")[1..].map { _1.gsub(/(.)([A-Z])/, '\1-\2') }.map(&:downcase).join("/") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phlex-0.3.2 | docs/page_builder.rb |
phlex-0.3.1 | docs/page_builder.rb |
phlex-0.3.0 | docs/page_builder.rb |