Sha256: 673d5f33a0e875a2558b702de39462e4ad0e95d7417fa7a877a489cee2f56f15
Contents?: true
Size: 667 Bytes
Versions: 12
Compression:
Stored size: 667 Bytes
Contents
# frozen_string_literal: true module Spandx module Core class PathTraversal attr_reader :root def initialize(root, recursive: true) @root = Pathname.new(root) @recursive = recursive end def each(&block) each_file_in(root, &block) end private def recursive? @recursive end def each_file_in(path, &block) files = path.directory? ? path.children : [path] files.each do |file| if file.directory? each_file_in(file, &block) if recursive? else block.call(file) end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems