Sha256: a143288d07f3dd0dfa564c32f85f081530b1a8be069bea4c2922cc6658269d4c

Contents?: true

Size: 841 Bytes

Versions: 10

Compression:

Stored size: 841 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)
        has_enviro = enviro && subject && subject.downcase.include?(enviro.downcase)
        subject    = "#{enviro.upcase} - #{subject}" if enviro && !has_enviro
        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

10 entries across 10 versions & 1 rubygems

Version Path
eco-rake-0.2.6 lib/eco-rake/utils/mailing.rb
eco-rake-0.2.5 lib/eco-rake/utils/mailing.rb
eco-rake-0.2.4 lib/eco-rake/utils/mailing.rb
eco-rake-0.2.3 lib/eco-rake/utils/mailing.rb
eco-rake-0.2.2 lib/eco-rake/utils/mailing.rb
eco-rake-0.2.1 lib/eco-rake/utils/mailing.rb
eco-rake-0.2.0 lib/eco-rake/utils/mailing.rb
eco-rake-0.1.6 lib/eco-rake/utils/mailing.rb
eco-rake-0.1.5 lib/eco-rake/utils/mailing.rb
eco-rake-0.1.4 lib/eco-rake/utils/mailing.rb