Class: CodeKindly::Utils::Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/code_kindly/utils/dir.rb

Class Method Summary collapse

Class Method Details

.all(path) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/code_kindly/utils/dir.rb', line 5

def all (path)
  require 'fileutils'
  return [] unless ::Dir.exist?(path)
  files = ::Dir.entries(path)
  files.reject!{ |f| "." == f || ".." == f || ".DS_Store" == f || ".keep" == f }
  files.sort
end

.find(path) ⇒ Object



13
14
15
16
# File 'lib/code_kindly/utils/dir.rb', line 13

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