lib/caramelize/services/page_builder.rb in caramelize-1.1.1 vs lib/caramelize/services/page_builder.rb in caramelize-1.2.0

- old
+ new

@@ -1,18 +1,21 @@ +# frozen_string_literal: true + module Caramelize module Services class PageBuilder + HEADLINE = "## Overview of namespaces\n" + def self.build_namespace_overview(namespaces) - body = "## Overview of namespaces\n\n" + # TODO: change wiki as configurable default home + # TODO support other markup syntaxes - namespaces.each do |namespace| - # TODO change wiki as configurable default home - # TODO support other markup syntaxes - body << "* [[#{namespace[:name]}|#{namespace[:identifier]}/wiki]] \n" - end + body = namespaces.map do |namespace| + "* [[#{namespace[:name]}|#{namespace[:identifier]}/wiki]]" + end.prepend(HEADLINE).join(" \n") - Page.new(title: "Home", - body: body, + Page.new(title: 'Home', + body:, message: 'Create Namespace Overview', latest: true) end end end