module MailHandler::Receiving::FileHandling

namespace

Public Instance Methods

access_file(file, default_return = false) { || ... } click to toggle source

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

# 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