Class: Organisir::Util
- Inherits:
-
Object
- Object
- Organisir::Util
- Defined in:
- lib/organisir/util.rb
Class Method Summary collapse
Class Method Details
.gen_regex_for_dir_name(dir) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/organisir/util.rb', line 13 def gen_regex_for_dir_name(dir) tokens = dir.downcase.split # TODO: Verify if this regex rule can be deprecated # name_token = tokens.join('\\b.*\\b') # Regexp.new("\\b#{name_token}\\b", Regexp::EXTENDED | Regexp::IGNORECASE) name_token = tokens.join(".*") Regexp.new(".*#{name_token}.*", Regexp::EXTENDED | Regexp::IGNORECASE) end |
.get_sub_dirs(dir) ⇒ Object
7 8 9 10 11 |
# File 'lib/organisir/util.rb', line 7 def get_sub_dirs(dir) Dir.chdir(dir) do Dir["*"].select { |o| File.directory?(o) } end end |