123456789_123456789_123456789_123456789_123456789_

Class: RSpec::Matchers::BuiltIn::ContainExactly::PairingsMaximizer::Solution Private

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#candidate?Boolean (readonly)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 194

def candidate?
  indeterminate_expected_indexes.empty? &&
  indeterminate_actual_indexes.empty?
end

#ideal?Boolean (readonly)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 199

def ideal?
  candidate? && (
    unmatched_expected_indexes.empty? ||
    unmatched_actual_indexes.empty?
  )
end

#indeterminate_actual_indexes (rw)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 188

Solution = Struct.new(:unmatched_expected_indexes,     :unmatched_actual_indexes,
:indeterminate_expected_indexes, :indeterminate_actual_indexes)

#indeterminate_expected_indexes (rw)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 188

Solution = Struct.new(:unmatched_expected_indexes,     :unmatched_actual_indexes,
:indeterminate_expected_indexes, :indeterminate_actual_indexes)

#unmatched_actual_indexes (rw)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 188

Solution = Struct.new(:unmatched_expected_indexes,     :unmatched_actual_indexes,
:indeterminate_expected_indexes, :indeterminate_actual_indexes)

#unmatched_expected_indexes (rw)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 188

Solution = Struct.new(:unmatched_expected_indexes,     :unmatched_actual_indexes,
:indeterminate_expected_indexes, :indeterminate_actual_indexes)

Instance Method Details

#+(derived_candidate_solution)

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 210

def +(derived_candidate_solution)
  self.class.new(
    unmatched_expected_indexes + derived_candidate_solution.unmatched_expected_indexes,
    unmatched_actual_indexes   + derived_candidate_solution.unmatched_actual_indexes,
    # Ignore the indeterminate indexes: by the time we get here,
    # we've dealt with all indeterminates.
    [], []
  )
end

#unmatched_item_count

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 206

def unmatched_item_count
  unmatched_expected_indexes.count + unmatched_actual_indexes.count
end

#worse_than?(other) ⇒ Boolean

[ GitHub ]

  
# File 'rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb', line 190

def worse_than?(other)
  unmatched_item_count > other.unmatched_item_count
end