Sha256: dbf93674ae82594907300cce6674c5ae6392df9cd78719d1155391e3b97cf262

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

require "rake"
require "refinements/struct"
require "tocer"

module Tocer
  module Rake
    # Registers Rake tasks for use.
    class Register
      include ::Rake::DSL
      include Dependencies[:settings]

      using Refinements::Struct

      def self.call = new.call

      def initialize(runner: Runner.new, **)
        @runner = runner
        super(**)
      end

      def call
        desc "Update/Insert Table of Contents"
        task :toc, %i[label patterns] do |_task, arguments|
          settings.merge! arguments
          runner.call
        end
      end

      private

      attr_reader :runner
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tocer-19.0.0 lib/tocer/rake/register.rb