Class: Mutiny::Mutants::MutationSet
- Inherits:
-
Object
- Object
- Mutiny::Mutants::MutationSet
- Defined in:
- lib/mutiny/mutants/mutation_set.rb
Instance Attribute Summary collapse
-
#mutations ⇒ Object
readonly
Returns the value of attribute mutations.
Instance Method Summary collapse
-
#initialize(*mutations) ⇒ MutationSet
constructor
A new instance of MutationSet.
-
#mutate(subjects) ⇒ Object
TODO : would performance improve by iterating over subjects than over operators? Probably could improve (more) if metamorpher also supported composite transformers so that several mutation operators could be matched simulatenously during a single AST traversal.
Constructor Details
#initialize(*mutations) ⇒ MutationSet
Returns a new instance of MutationSet.
9 10 11 |
# File 'lib/mutiny/mutants/mutation_set.rb', line 9 def initialize(*mutations) @mutations = mutations end |
Instance Attribute Details
#mutations ⇒ Object (readonly)
Returns the value of attribute mutations.
7 8 9 |
# File 'lib/mutiny/mutants/mutation_set.rb', line 7 def mutations @mutations end |
Instance Method Details
#mutate(subjects) ⇒ Object
TODO : would performance improve by iterating over subjects than over operators? Probably could improve (more) if metamorpher also supported composite transformers so that several mutation operators could be matched simulatenously during a single AST traversal
16 17 18 19 20 21 22 |
# File 'lib/mutiny/mutants/mutation_set.rb', line 16 def mutate(subjects) mutants = MutantSet.new subjects.product(mutations).each do |subject, mutation| mutants.concat(mutate_one(subject, mutation)) end mutants end |