Sha256: 7be2d2667fd3c62144ea0a72035c70742351a6f66f34cc2aafa2b8e4a7af147a

Contents?: true

Size: 746 Bytes

Versions: 8

Compression:

Stored size: 746 Bytes

Contents

# encoding: utf-8
require 'rails_best_practices/core/check'

module RailsBestPractices
  module Prepares
    # Remember the mailer names.
    class MailerPrepare < Core::Check

      def interesting_nodes
        [:class]
      end

      def interesting_files
        /#{MAILER_FILES}|#{MODEL_FILES}/
      end

      def initialize
        @mailer_names = []
      end

      # check class node.
      #
      # if it is a subclass of ActionMailer::Base,
      # then remember its class name.
      def start_class(class_node)
        if s(:colon2, s(:const, :ActionMailer), :Base) == class_node.base_class
          @mailer_names << class_node.class_name
          Prepares.mailer_names = @mailer_names
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails_best_practices-0.8.0 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-0.7.5 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-0.7.4 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-0.7.3 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-0.7.2 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-0.7.1 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-0.7.0 lib/rails_best_practices/prepares/mailer_prepare.rb
rails_best_practices-0.6.7 lib/rails_best_practices/prepares/mailer_prepare.rb