Sha256: fb9e2073978c403c10cde6c068c9f3a5cec424c61434bbd369724dca64ff5026

Contents?: true

Size: 703 Bytes

Versions: 7

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 "Update/Insert Table of Contents"
        task :toc, %i[label patterns] do |_task, arguments|
          runner.call configuration.merge(arguments.to_h)
        end
      end

      private

      attr_reader :configuration, :runner
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tocer-16.2.1 lib/tocer/rake/register.rb
tocer-16.2.0 lib/tocer/rake/register.rb
tocer-16.1.0 lib/tocer/rake/register.rb
tocer-16.0.3 lib/tocer/rake/register.rb
tocer-16.0.2 lib/tocer/rake/register.rb
tocer-16.0.1 lib/tocer/rake/register.rb
tocer-16.0.0 lib/tocer/rake/register.rb