# frozen_string_literal: true

require 'letter_opener/delivery_method'

module LetterOpenerWeb
  class DeliveryMethod < LetterOpener::DeliveryMethod
    def deliver!(mail)
      location = File.join(settings[:location], "#{Time.now.to_i}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}")
      LetterOpener::Message.rendered_messages(location, mail)
    end
  end
end

# frozen_string_literal: true

require 'letter_opener/delivery_method'

module LetterOpenerWeb
  class DeliveryMethod < LetterOpener::DeliveryMethod
    def deliver!(mail)
      ENV['LAUNCHY_DRY_RUN'] = 'true'
      super
      ENV['LAUNCHY_DRY_RUN'] = 'false'
    end
  end
end

Disable Launchy using ENV variable instead of completely redefining `deliver!` method.
Disable Launchy using ENV variable instead of completely redefining `deliver!` method.
