Sha256: 635b27bdb23c87420413fd3de86e20c7fb01644d0ad6c229a0d8b35e29573927

Contents?: true

Size: 730 Bytes

Versions: 6

Compression:

Stored size: 730 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathname"
require "stringio"
require "tocer"

module Rubysmith
  module Extensions
    # Ensures project skeleton documentation has table of content.
    class Tocer
      include Import[:settings, :logger]

      using Refinements::Pathname

      def initialize(client: ::Tocer::Runner.new(io: StringIO.new), **)
        @client = client
        super(**)
      end

      def call
        return false unless settings.build_readme && settings.markdown?

        logger.info { "Adding table of contents..." }
        upsert
        true
      end

      private

      attr_reader :client

      def upsert = settings.project_root.change_dir { client.call }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubysmith-7.9.0 lib/rubysmith/extensions/tocer.rb
rubysmith-7.8.0 lib/rubysmith/extensions/tocer.rb
rubysmith-7.7.0 lib/rubysmith/extensions/tocer.rb
rubysmith-7.6.0 lib/rubysmith/extensions/tocer.rb
rubysmith-7.5.0 lib/rubysmith/extensions/tocer.rb
rubysmith-7.4.0 lib/rubysmith/extensions/tocer.rb