Module: StringInPath
- Defined in:
- lib/string_in_path.rb,
lib/string_in_path/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
Class Method Details
.present(str_to_find, path) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/string_in_path.rb', line 4 def self.present (str_to_find, path) require 'string_in_file' require 'find' Find.find(path) do |filename| next if filename == ".DS_Store" if StringInFile.present(str_to_find,filename) == true return true end end return false end |
.replace(str1, str2, path) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/string_in_path.rb', line 16 def self.replace (str1, str2, path) require 'string_in_file' require 'find' Find.find(path) do |filename| file_type = `file -b #{filename}` if file_type.include?("directory") == false && filename.include?(".DS_Store") == false StringInFile.replace(str1, str2, filename) system("rm -f #{filename}-e") end end end |