Class: CodeKindly::Utils::Dir
- Inherits:
-
Object
- Object
- CodeKindly::Utils::Dir
- Defined in:
- lib/code_kindly/utils/dir.rb
Constant Summary collapse
- SKIP_DIRS =
['.', '..', '.DS_Store', '.keep'].map(&:freeze).freeze
Class Method Summary collapse
Class Method Details
.all(path) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/code_kindly/utils/dir.rb', line 9 def all(path) require 'fileutils' return [] unless ::Dir.exist?(path) files = ::Dir.entries(path) files.reject! { |f| SKIP_DIRS.include? f } files.sort end |
.find(path) ⇒ Object
17 18 19 20 |
# File 'lib/code_kindly/utils/dir.rb', line 17 def find(path) require 'fileutils' all(path).select { |entry| ::File.directory?("#{path}/#{entry}") } end |