class CheckFile

Public Instance Methods

check_file?(file) click to toggle source
# File lib/check_file.rb, line 12
def check_file?(file)
  check_path?(file.path)
end
check_path?(path) click to toggle source
# File lib/check_file.rb, line 2
def check_path?(path)
  accepted_formats = [".xls"]
  unless File.file?(path)
    raise 'File does not exist'
  end
  unless accepted_formats.include? File.extname(path)
    raise 'Not accepted format: ' + File.extname(path)
  end
end