Module: ShiftSubtitles::FileHelper

Defined in:
lib/shift_subtitles/file_helper.rb

Class Method Summary collapse

Class Method Details

.operation_with_validation(operation, file_name) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/shift_subtitles/file_helper.rb', line 5

def self.operation_with_validation operation, file_name
  raise("Please specify an #{operation} file") unless file_name
  if operation == 'input'
    raise("Please specify a valid #{operation} file") unless File.exists?(file_name)
  end
  yield      
end