Sha256: 499cd81fd0b2ea3c5daa81c70d34ab6c291e484bb6d3c137c6973fa12f7c508d

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

class EcoRake
  module Utils
    module Mailing
      # @return [EcoRake::Mailer]
      def mailer
        @mailer ||= EcoRake::Utils::Mailer.new
      end

      def email(subject:, body:, to:, enviro: nil)
        subject = "#{enviro.upcase} - #{subject}" unless !enviro && subject.downcase.include?(enviro.downcase)
        mailer.mail(**{
          to:      to,
          subject: subject,
          body:    body
        })
      end

      # Helper to notify that there are no files to be processed
      def email_missing_files(enviro:, to:)
        email(**{
          to:      to,
          subject: "#{enviro.upcase} (No files to be processed)",
          body:    'No files found to be processed. Aborting...'
        })
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eco-rake-0.1.2 lib/eco-rake/utils/mailing.rb