Module: EcoRake::Utils::Mailing

Defined in:
lib/eco-rake/utils/mailing.rb

Instance Method Summary collapse

Instance Method Details

#email(subject:, body:, to:, enviro: nil) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/eco-rake/utils/mailing.rb', line 9

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

#email_missing_files(enviro:, to:) ⇒ Object

Helper to notify that there are no files to be processed



20
21
22
23
24
25
26
# File 'lib/eco-rake/utils/mailing.rb', line 20

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

#mailerEcoRake::Mailer

Returns:

  • (EcoRake::Mailer)


5
6
7
# File 'lib/eco-rake/utils/mailing.rb', line 5

def mailer
  @mailer ||= EcoRake::Utils::Mailer.new
end