Class: Mutiny::Mutants::MutantSet
- Inherits:
-
Object
- Object
- Mutiny::Mutants::MutantSet
- Extended by:
- Forwardable
- Defined in:
- lib/mutiny/mutants/mutant_set.rb
Defined Under Namespace
Classes: OrderedMutant
Instance Method Summary collapse
- #group_by_subject ⇒ Object
- #mutants ⇒ Object
- #ordered ⇒ Object
- #store(mutant_directory = ".mutants") ⇒ Object
Instance Method Details
#group_by_subject ⇒ Object
13 14 15 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 13 def group_by_subject mutants.group_by(&:subject).dup end |
#mutants ⇒ Object
9 10 11 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 9 def mutants @mutants ||= [] end |
#ordered ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 17 def ordered group_by_subject.flat_map do |_, mutants| mutants.map.with_index do |mutant, index| OrderedMutant.new(mutant, index) end end end |
#store(mutant_directory = ".mutants") ⇒ Object
25 26 27 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 25 def store(mutant_directory = ".mutants") ordered.each { |m| m.store(mutant_directory) } end |