Class: Mutant::Matcher::ScopeMethods
- Inherits:
-
Mutant::Matcher
- Object
- Mutant::Matcher
- Mutant::Matcher::ScopeMethods
- Includes:
- AbstractType
- Defined in:
- lib/mutant/matcher/scope_methods.rb
Overview
Abstract base class for matcher that returns subjects extracted from scope methods
Defined Under Namespace
Instance Attribute Summary collapse
-
#scope ⇒ Class, Model
readonly
private
Return scope.
Class Method Summary collapse
-
.method_names(object) ⇒ Enumerable<Symbol>
private
Return method names.
Instance Method Summary collapse
-
#each(&block) ⇒ self, Enumerator<Subject>
private
Enumerate subjects.
-
#matcher ⇒ Class:Matcher::Method
private
Return method matcher class.
-
#methods ⇒ Enumerable<Method, UnboundMethod>
private
Return methods.
Methods inherited from Mutant::Matcher
from_string, #identification, parse
Instance Attribute Details
#scope ⇒ Class, Model (readonly)
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.
Return scope
13 14 15 |
# File 'lib/mutant/matcher/scope_methods.rb', line 13 def scope @scope end |
Class Method Details
.method_names(object) ⇒ Enumerable<Symbol>
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.
Return method names
66 67 68 69 70 |
# File 'lib/mutant/matcher/scope_methods.rb', line 66 def self.method_names(object) object.public_instance_methods(false) + object.private_instance_methods(false) + object.protected_instance_methods(false) end |
Instance Method Details
#each(&block) ⇒ self, Enumerator<Subject>
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.
Enumerate subjects
25 26 27 28 29 30 31 32 33 |
# File 'lib/mutant/matcher/scope_methods.rb', line 25 def each(&block) return to_enum unless block_given? methods.each do |method| emit_matches(method, &block) end self end |
#matcher ⇒ Class:Matcher::Method
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.
Return method matcher class
54 55 56 |
# File 'lib/mutant/matcher/scope_methods.rb', line 54 def matcher self.class::MATCHER end |
#methods ⇒ Enumerable<Method, UnboundMethod>
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.
Return methods
41 42 43 44 45 |
# File 'lib/mutant/matcher/scope_methods.rb', line 41 def methods method_names.map do |name| access(name) end end |