Sha256: 5ab8e483aec77d027f09300be1cdce8f3991df2b73832f6a73edc2adf4f17c0e
Contents?: true
Size: 716 Bytes
Versions: 4
Compression:
Stored size: 716 Bytes
Contents
# frozen_string_literal: true require "pathname" module Tocer # Generates/updates Table of Contents for files in given path. class Runner def initialize path = ".", configuration: {}, writer: Writer @path = Pathname path @configuration = configuration @writer = writer end def files return [] unless path.exist? && path.directory? && !includes.empty? Pathname.glob(%(#{path}/{#{includes.join ","}})).select(&:file?) end def run files.each { |file| writer.new(file, label: configuration.fetch(:label)).write } end private attr_reader :path, :configuration, :writer def includes Array configuration[:includes] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tocer-8.2.1 | lib/tocer/runner.rb |
tocer-8.2.0 | lib/tocer/runner.rb |
tocer-8.1.0 | lib/tocer/runner.rb |
tocer-8.0.0 | lib/tocer/runner.rb |