Class: Mutant::Subject::Method::Instance::ModuleFunction Private

Inherits:
Mutant::Subject::Method::Instance show all
Defined in:
lib/mutant/subject/method/instance.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Subject for instance methods exposed via module_function

module_function copies the method onto the module's singleton class. Redefining only the instance method would leave that copy, which callers use, unmutated.

Constant Summary

Constants inherited from Mutant::Subject::Method::Instance

NAME_INDEX, SYMBOL

Instance Method Summary collapse

Methods inherited from Mutant::Subject::Method

#expression, #match_expressions, #name

Methods inherited from Mutant::Subject

#expression, #identification, #inline_disabled?, #match_expressions, #mutations, #source, #source_line, #source_lines, #source_path

Instance Method Details

#post_insert ⇒ self

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.

Copy the inserted method onto the singleton class again

Returns:

  • (self)


61
# File 'lib/mutant/subject/method/instance.rb', line 61

def post_insert = tap { scope.raw.__send__(:module_function, name) }

#prepare ⇒ self

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.

Prepare subject for mutation insertion

Returns:

  • (self)


52
53
54
55
56
# File 'lib/mutant/subject/method/instance.rb', line 52

def prepare
  scope.raw.singleton_class.undef_method(name)

  super
end