Class: Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/glue_envs/filesystem/filesystem_files_mgr.rb

Overview

TODO: Move this into a MonkeyPatch named module (called by file glue) Tinkit.monkey_patch punching_dir or something

Class Method Summary collapse

Class Method Details

.file_data_entries(dir = Dir.pwd) ⇒ Object

TODO: this duplicates working_entries is it needed?



26
27
28
29
30
31
# File 'lib/glue_envs/filesystem/filesystem_files_mgr.rb', line 26

def self.file_data_entries(dir=Dir.pwd)
  ignore_list = ['parent_categories.txt', 'description.txt']
  wkg_entries = Dir.working_entries(dir)
  file_data_entries = wkg_entries.delete_if {|x| ignore_list.include?(x.downcase)}
  return file_data_entries
end

.working_entries(dir = Dir.pwd) ⇒ Object

monkey patch (duck punching?)



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/glue_envs/filesystem/filesystem_files_mgr.rb', line 12

def self.working_entries(dir=Dir.pwd)
  ignore_list = ['thumbs.db','all_child_files']
  all_entries = if File.exists?(dir)
    Dir.entries(dir)
  else
    nil
  end
  wgk_entries = nil
  wkg_entries = all_entries.delete_if {|x| x[0] == '.'} if all_entries
  wkg_entries = wkg_entries.delete_if {|x| ignore_list.include?(x.downcase)} if wkg_entries
  return wkg_entries
end