Sha256: a5e1ea31683c1cd1481cf4b9b8da86fb5d3a84a5b2b0835bce1af0f32f7bb437
Contents?: true
Size: 716 Bytes
Versions: 15
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 call files.each { |file| writer.new(file, label: configuration.fetch(:label)).call } end private attr_reader :path, :configuration, :writer def includes Array configuration[:includes] end end end
Version data entries
15 entries across 15 versions & 1 rubygems