Method: FileUtils#analyze_file
- Defined in:
- lib/batch_audio_convert/file_utils.rb
#analyze_file(file) ⇒ Object
Define destination name and transormation method to apply for a file.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/batch_audio_convert/file_utils.rb', line 42 def analyze_file(file) method_name = :copy destination_file = String.new(file) config[:extensions].each do |origin_ext, destination_ext| origin_ext = origin_ext.to_s destination_ext = destination_ext.to_s if file =~ /\.#{origin_ext}$/i destination_file.gsub! /\.#{origin_ext}$/i, ".#{destination_ext}" method_name = origin_ext + '_to_' + destination_ext break end end replace_folder_in_destination! destination_file return {:method_name => method_name, :destination_file => destination_file} end |