Module: RailsBestPractices::Core::Check::Afterable

Included in:
Prepares::ControllerPrepare, Prepares::ModelPrepare
Defined in:
lib/rails_best_practices/core/check.rb

Overview

Helper to add callback after all files reviewed.

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/rails_best_practices/core/check.rb', line 247

def self.included(base)
  base.class_eval do
    interesting_nodes :class
    interesting_files /rails_best_practices\.after_(prepare|review)/

    add_callback "end_class" do |node|
      if "RailsBestPractices::AfterPrepare" == node.class_name.to_s
        after_prepare
      elsif "RailsBestPractices::AfterReview" == node.class_name.to_s
        after_review
      end
    end
  end
end