Sha256: ccd7e1cf64eccc063d914586b34e3255de15b69e87a3f85f8fc794bfcd5918f4

Contents?: true

Size: 680 Bytes

Versions: 5

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

require "refinements/pathname"

module Tocer
  # Generates/updates Table of Contents for files in root path.
  class Runner
    include Import[:kernel]

    using Refinements::Pathname

    def initialize(writer: Writer.new, **)
      super(**)
      @writer = writer
    end

    # :reek:FeatureEnvy
    def call configuration
      configuration.root_dir
                   .files(%({#{configuration.patterns.join ","}}))
                   .each do |path|
                     kernel.puts "  #{path}"
                     writer.call path, label: configuration.label
                   end
    end

    private

    attr_reader :writer
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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