Sha256: b6fcb5e51749cdbd4b7b8d3a3c17364430c936711faf3728b02661cc2ec137f8

Contents?: true

Size: 631 Bytes

Versions: 7

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true

module RailsBestPractices
  module Prepares
    # Remember the mailer names.

    class MailerPrepare < Core::Check
      include Core::Check::Classable

      interesting_nodes :class
      interesting_files MAILER_FILES, MODEL_FILES

      def initialize
        @mailers = Prepares.mailers
      end

      # check class node.
      #
      # if it is a subclass of ActionMailer::Base,
      # then remember its class name.
      add_callback :start_class do |_node|
        if current_extend_class_name == 'ActionMailer::Base'
          @mailers << @klass
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_best_practices-1.23.2 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-1.23.1 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-1.23.0 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-1.22.1 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-1.22.0 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-1.21.0 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-1.20.1 lib/rails_best_practices/prepares/mailer_prepare.rb