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 Attribute Summary collapse
-
#mutants ⇒ Object
readonly
Returns the value of attribute mutants.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #group_by_subject ⇒ Object
- #hash ⇒ Object
-
#initialize(*mutants) ⇒ MutantSet
constructor
A new instance of MutantSet.
- #ordered ⇒ Object
- #store(mutant_directory = ".mutants") ⇒ Object
Constructor Details
#initialize(*mutants) ⇒ MutantSet
12 13 14 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 12 def initialize(*mutants) @mutants = mutants end |
Instance Attribute Details
#mutants ⇒ Object (readonly)
Returns the value of attribute mutants.
10 11 12 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 10 def mutants @mutants end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
32 33 34 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 32 def eql?(other) other.mutants == mutants end |
#group_by_subject ⇒ Object
16 17 18 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 16 def group_by_subject mutants.group_by(&:subject).dup end |
#hash ⇒ Object
38 39 40 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 38 def hash mutants.hash end |
#ordered ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 20 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
28 29 30 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 28 def store(mutant_directory = ".mutants") ordered.each { |m| m.store(mutant_directory) } end |