Method: RuboCop::Cop::Base.callbacks_needed
- Defined in:
- lib/rubocop/cop/base.rb
permalink .callbacks_needed ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
329 330 331 332 333 334 335 336 337 338 |
# File 'lib/rubocop/cop/base.rb', line 329 def self.callbacks_needed @callbacks_needed ||= public_instance_methods.select do |m| # OPTIMIZE: Check method existence first to make fewer `start_with?` calls. # At the time of writing this comment, this excludes 98 of ~104 methods. # `start_with?` with two string arguments instead of a regex is faster # in this specific case as well. !Base.method_defined?(m) && # exclude standard "callbacks" like 'on_begin_investigation' m.start_with?('on_', 'after_') end end |