Sha256: 8f43749e959b52487dc2107c30536325e782712086731d21fc72bdba43ffeaa3

Contents?: true

Size: 703 Bytes

Versions: 5

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

require "rake"
require "refinements/structs"
require "tocer"

module Tocer
  module Rake
    # Registers Rake tasks for use.
    class Register
      include ::Rake::DSL
      using Refinements::Structs

      def self.call = new.call

      def initialize configuration = Container[:configuration], runner: Runner.new
        @configuration = configuration
        @runner = runner
      end

      def call
        desc "Insert/Update Table of Contents"
        task :toc, %i[label includes] do |_task, arguments|
          runner.call configuration.merge(arguments.to_h)
        end
      end

      private

      attr_reader :configuration, :runner
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tocer-15.2.0 lib/tocer/rake/register.rb
tocer-15.1.2 lib/tocer/rake/register.rb
tocer-15.1.1 lib/tocer/rake/register.rb
tocer-15.1.0 lib/tocer/rake/register.rb
tocer-15.0.0 lib/tocer/rake/register.rb