Sha256: 304c23e116974d2abaf143f19b49648dbd138d9aba7aa94b71f08c49c6452c82

Contents?: true

Size: 659 Bytes

Versions: 8

Compression:

Stored size: 659 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 Import[: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

8 entries across 8 versions & 1 rubygems

Version Path
tocer-18.7.0 lib/tocer/rake/register.rb
tocer-18.6.0 lib/tocer/rake/register.rb
tocer-18.5.0 lib/tocer/rake/register.rb
tocer-18.4.0 lib/tocer/rake/register.rb
tocer-18.3.0 lib/tocer/rake/register.rb
tocer-18.2.0 lib/tocer/rake/register.rb
tocer-18.1.0 lib/tocer/rake/register.rb
tocer-18.0.0 lib/tocer/rake/register.rb