Sha256: 4d4c29ef0957536dd65ac9a6ec0fb1dc4e3e130f2cc6afc4ba450b527f76e864

Contents?: true

Size: 488 Bytes

Versions: 3

Compression:

Stored size: 488 Bytes

Contents

# frozen_string_literal: true

# Return the list of file paths in a directory
module Speg
  module FilePaths
    def file_paths(directory)
      entries = Dir.entries(directory).reject { |f| f.start_with?('.') }

      files = []

      entries.each do |entry|
        full_path = File.join(directory, entry)
        if File.directory?(full_path)
          files.concat(file_paths(full_path))
        else
          files << full_path
        end
      end

      files
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
speg-1.3.0 lib/speg/file_paths.rb
speg-1.2.0 lib/speg/file_paths.rb
speg-1.1.2 lib/speg/file_paths.rb