Sha256: 6f873ea88adcb71105682881e2efced699ab35c561aba1344a544adbcc1d1839

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 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 'ActionMailer::Base' == current_extend_class_name
          @mailers << @klass
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_best_practices-1.19.3 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-1.19.2 lib/rails_best_practices/prepares/mailer_prepare.rb