Class: Mutant::Subject::Method::Instance
- Inherits:
-
Mutant::Subject::Method
- Object
- Mutant::Subject
- Mutant::Subject::Method
- Mutant::Subject::Method::Instance
- Defined in:
- lib/mutant/subject/method/instance.rb
Overview
Instance method subjects
Direct Known Subclasses
Defined Under Namespace
Classes: Memoized
Constant Summary collapse
- NAME_INDEX =
0
- SYMBOL =
'#'.freeze
- WARN_METHODS_UNDEFINED =
A list of methods that will warn when they are undefined
if RUBY_ENGINE.eql?('ruby') [:initialize, :__send__, :object_id].freeze else EMPTY_ARRAY end
- LINE_INCREMENT =
defined?(Zombie) ? -11 : 5
Instance Method Summary collapse
-
#prepare ⇒ self
private
Prepare subject for mutation insertion.
-
#public? ⇒ Boolean
private
Test if method is public.
Methods inherited from Mutant::Subject::Method
Methods inherited from Mutant::Subject
#expression, #identification, #match_expressions, #mutations, #root, #source, #source_line, #source_path, #tests
Instance Method Details
#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
37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mutant/subject/method/instance.rb', line 37 def prepare expected_warnings = if WARN_METHODS_UNDEFINED.include?(name) ["#{__FILE__}:#{__LINE__ + LINE_INCREMENT}: warning: undefining `#{name}' may cause serious problems\n"] else EMPTY_ARRAY end WarningExpectation.new(expected_warnings).execute do scope.send(:undef_method, name) end self end |
#public? ⇒ Boolean
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.
Test if method is public
24 25 26 |
# File 'lib/mutant/subject/method/instance.rb', line 24 def public? scope.public_method_defined?(name) end |