Module: MailHandler::Receiving::FileHandling

Included in:
FileList, FolderChecker
Defined in:
lib/mailhandler/receiving/filelist/base.rb

Overview

namespace

Instance Method Summary collapse

Instance Method Details

#access_file(file, default_return = false) ⇒ Object

if file exists, execute file operation, otherwise return default return value when it doesn’t



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mailhandler/receiving/filelist/base.rb', line 13

def access_file(file, default_return = false)
  if File.exist? file

    begin
      yield
    rescue StandardError => e
      raise e if File.exist? file

      default_return
    end

  else

    default_return

  end
end