Module: Mutineer::ReloadGuards::CallbackReskipping

Defined in:
lib/mutineer/reload_guards.rb

Overview

Makes a repeated skip a no-op, during a mutant load only. The class body outside methods is the original's, and the original's first run already removed the callback from this class, so a skip there is a repeat. It counts as one when each filter is a method the class has (a callback the parent or an included concern installed) or a callback the parent still has. A skip that names neither keeps Rails' check and still raises (scored error), so a typo is not hidden.

Instance Method Summary collapse

Instance Method Details

#skip_callback(name, *filter_list, &block) ⇒ void

This method returns an undefined value.

Parameters:

  • name (Symbol) —

    the callback chain, such as :save.

  • filter_list (Array) —

    the kind, the filters, and options.



66
67
68
69
70
71
72
# File 'lib/mutineer/reload_guards.rb', line 66

def skip_callback(name, *filter_list, &block)
  return super unless ReloadGuards.loading?

  options = filter_list.last.is_a?(Hash) ? filter_list.pop : {}
  options = { raise: false }.merge(options) if ReloadGuards.repeated_skip?(self, name, *filter_list)
  super(name, *filter_list, options, &block)
end