Module: Burek::FileHelpers
- Defined in:
- lib/file_helpers.rb
Class Method Summary collapse
Class Method Details
.create_folder_if_missing(path) ⇒ Object
23 24 25 |
# File 'lib/file_helpers.rb', line 23 def self.create_folder_if_missing(path) Dir.mkdir(path) unless File.directory?(path) end |
.for_each_file ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/file_helpers.rb', line 13 def self.for_each_file Burek.config.get(:search_folders).each do |folder| Dir.glob(folder) do |file_name| unless File.directory?(file_name) yield file_name end end end end |
.open_each_file ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/file_helpers.rb', line 4 def self.open_each_file for_each_file do |file_name| File.open(file_name, "rb:UTF-8") do |file| contents = file.read yield contents, file_name end end end |