Class: Mutiny::Mutants::MutantSet
- Inherits:
-
Object
- Object
- Mutiny::Mutants::MutantSet
- Extended by:
- Forwardable
- Defined in:
- lib/mutiny/mutants/mutant_set.rb
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
Constructor Details
#initialize(*mutants) ⇒ MutantSet
Returns a new instance of 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: ==
29 30 31 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 29 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
35 36 37 |
# File 'lib/mutiny/mutants/mutant_set.rb', line 35 def hash mutants.hash end |
#ordered ⇒ Object
20 21 22 23 24 25 26 27 |
# 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| mutant.index ||= index mutant end end end |