Sha256: 59bcc4089a6e989cde250ea1bd25db8a6bbf3c585f8151ee956417bd119234b9

Contents?: true

Size: 605 Bytes

Versions: 8

Compression:

Stored size: 605 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[:settings, :io]

    using Refinements::Pathname

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

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

    private

    attr_reader :writer
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tocer-18.7.0 lib/tocer/runner.rb
tocer-18.6.0 lib/tocer/runner.rb
tocer-18.5.0 lib/tocer/runner.rb
tocer-18.4.0 lib/tocer/runner.rb
tocer-18.3.0 lib/tocer/runner.rb
tocer-18.2.0 lib/tocer/runner.rb
tocer-18.1.0 lib/tocer/runner.rb
tocer-18.0.0 lib/tocer/runner.rb