Sha256: 45bed2643fa1dce514026cce5603bd6438d79fe7dbe7d727c0508cfcbbb3b846

Contents?: true

Size: 701 Bytes

Versions: 5

Compression:

Stored size: 701 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
      using Refinements::Struct

      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

5 entries across 5 versions & 1 rubygems

Version Path
tocer-17.5.0 lib/tocer/rake/register.rb
tocer-17.3.0 lib/tocer/rake/register.rb
tocer-17.2.0 lib/tocer/rake/register.rb
tocer-17.1.0 lib/tocer/rake/register.rb
tocer-17.0.0 lib/tocer/rake/register.rb