Sha256: 68ec07ce484b3ef82ef1ec893c3ec4102ed1539999fe975543d767a25aa063b9

Contents?: true

Size: 565 Bytes

Versions: 10

Compression:

Stored size: 565 Bytes

Contents

# frozen_string_literal: true

module CodeKindly
  module Utils
    class Dir
      SKIP_DIRS = ['.', '..', '.DS_Store', '.keep'].map(&:freeze).freeze

      class << self
        def all(path)
          require 'fileutils'
          return [] unless ::Dir.exist?(path)
          files = ::Dir.entries(path)
          files.reject! { |f| SKIP_DIRS.include? f }
          files.sort
        end

        def find(path)
          require 'fileutils'
          all(path).select { |entry| ::File.directory?("#{path}/#{entry}") }
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
codekindly-utils-0.1.0 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.14 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.13 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.12 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.11 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.10 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.9 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.8 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.7 lib/code_kindly/utils/dir.rb
codekindly-utils-0.0.6 lib/code_kindly/utils/dir.rb