Sha256: da59f1952b6408826b5634baf5460abf85b1e41a5d1ea47e03fa008fe656081d

Contents?: true

Size: 620 Bytes

Versions: 4

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true

module Caramelize
  module Services
    class PageBuilder
      HEADLINE = "## Overview of namespaces\n"

      def self.build_namespace_overview(namespaces)
        # TODO: change wiki as configurable default home
        # TODO support other markup syntaxes

        body = namespaces.map do |namespace|
          "* [[#{namespace[:name]}|#{namespace[:identifier]}/wiki]]"
        end.prepend(HEADLINE).join("  \n")

        Page.new(title: 'Home',
                 body:,
                 message: 'Create Namespace Overview',
                 latest: true)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
caramelize-1.3.1 lib/caramelize/services/page_builder.rb
caramelize-1.3.0 lib/caramelize/services/page_builder.rb
caramelize-1.2.1 lib/caramelize/services/page_builder.rb
caramelize-1.2.0 lib/caramelize/services/page_builder.rb