class RailsBestPractices::Reviews::RemoveUnusedMethodsInControllersReview
Find out unused methods in controllers.
Implementation:
Review
process:
remember all method calls in controllers, if they are not defined in routes, and they are not called in controllers, then they are the unused methods in controllers.
Constants
- INHERITED_RESOURCES_METHODS
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
# File lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb, line 27 def initialize(options = {}) super @controller_methods = Prepares.controller_methods @routes = Prepares.routes @inherited_resources = false end
Public Instance Methods
skip_command_callback_nodes()
click to toggle source
skip render and around_filter nodes for start_command callbacks.
# File lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb, line 48 def skip_command_callback_nodes %w[render_cell render around_filter] end
Protected Instance Methods
internal_except_methods()
click to toggle source
# File lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb, line 116 def internal_except_methods %w[rescue_action default_url_options].map { |method_name| "*\##{method_name}" } + %w[Devise::OmniauthCallbacksController].map { |controller_name| "#{controller_name}#*" } end
mark_publicize(method_name, class_name = current_class_name)
click to toggle source
# File lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb, line 121 def mark_publicize(method_name, class_name = current_class_name) @controller_methods.mark_publicize(class_name, method_name) @controller_methods.mark_parent_class_methods_publicize(class_name, method_name) end
methods()
click to toggle source
# File lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb, line 112 def methods @controller_methods end