lib/rubocop/cop/base.rb in rubocop-0.93.1 vs lib/rubocop/cop/base.rb in rubocop-1.0.0

- old
+ new

@@ -259,10 +259,25 @@ def offenses raise 'The offenses are not directly available; ' \ 'they are returned as the result of the investigation' end + ### Reserved for Commissioner + + # @api private + def callbacks_needed + self.class.callbacks_needed + end + + # @api private + def self.callbacks_needed + @callbacks_needed ||= public_instance_methods.select do |m| + m.match?(/^on_|^after_/) && + !Base.method_defined?(m) # exclude standard "callbacks" like 'on_begin_investigation' + end + end + private ### Reserved for Cop::Cop def callback_argument(range) @@ -289,10 +304,10 @@ def currently_disabled_lines @currently_disabled_lines ||= Set.new end private_class_method def self.restrict_on_send - @restrict_on_send ||= self::RESTRICT_ON_SEND.to_set.freeze + @restrict_on_send ||= self::RESTRICT_ON_SEND.to_a.freeze end # Called before any investigation def begin_investigation(processed_source) @current_offenses = []