Module: FileListExtension

Defined in:
lib/require-dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#requiredObject

Returns the value of attribute required.



63
64
65
# File 'lib/require-dsl.rb', line 63

def required
  @required
end

Instance Method Details

#except_files(*reject_files) ⇒ Object



96
97
98
99
100
101
# File 'lib/require-dsl.rb', line 96

def except_files *reject_files
  self.reject! do |file| 
    file.matches_any reject_files
  end
  self
end

#except_folders(*reject_folders) ⇒ Object



88
89
90
91
92
93
# File 'lib/require-dsl.rb', line 88

def except_folders *reject_folders    
  self.reject! do |file| 
    file.matches_any_folder reject_folders
  end
  self
end

#only_files(*only_files) ⇒ Object



110
111
112
113
114
115
# File 'lib/require-dsl.rb', line 110

def only_files *only_files
  self.select! do |file| 
    file.matches_any only_files
  end
  self
end

#only_folders(*only_folders) ⇒ Object



103
104
105
106
107
108
# File 'lib/require-dsl.rb', line 103

def only_folders *only_folders
  self.select! do |file| 
    !file.inside_a_folder? || file.matches_any_folder(only_folders)
  end
  self
end

#prefix_with_path!(location) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/require-dsl.rb', line 65

def prefix_with_path! location    
  self.map! do |f| 
    f = File.join(location, f).extend(FileString)
    f.required = required       
    f
  end
  self          
end

#select_ruby_files!Object



83
84
85
86
# File 'lib/require-dsl.rb', line 83

def select_ruby_files!
  self.select! {|f| (f =~ /[^\.]*.rb$/) == 0 }
  self
end

#strip_file_ext(mode = nil) ⇒ Object



74
75
76
77
78
79
80
81
# File 'lib/require-dsl.rb', line 74

def strip_file_ext mode = nil
  self.map!{|f| f.remove_rb }
  if mode
    self.action mode
  else
    self
  end
end