Sha256: 7349c1643c6e8754c723a9333d4f89dfcd172a3ef5d4b86826b64f8d7ee7e7c6

Contents?: true

Size: 742 Bytes

Versions: 7

Compression:

Stored size: 742 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathnames"

module Tocer
  # Generates/updates Table of Contents for files in root path.
  class Runner
    using Refinements::Pathnames

    def initialize configuration: CLI::Configuration::Loader.call, writer: Writer.new
      @configuration = configuration
      @writer = writer
    end

    def call root_dir: ".", label: configuration.label, includes: configuration.includes
      Pathname(root_dir).files(%({#{includes.join ","}}))
                        .each do |path|
                          yield path if block_given?
                          writer.call path, label: label
                        end
    end

    private

    attr_reader :configuration, :writer
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tocer-12.2.0 lib/tocer/runner.rb
tocer-12.1.0 lib/tocer/runner.rb
tocer-12.0.4 lib/tocer/runner.rb
tocer-12.0.3 lib/tocer/runner.rb
tocer-12.0.2 lib/tocer/runner.rb
tocer-12.0.1 lib/tocer/runner.rb
tocer-12.0.0 lib/tocer/runner.rb