Class: Equalshares::TieBreaker::Extreme

Inherits:
Object
  • Object
show all
Defined in:
lib/equalshares/tie_breaker.rb

Overview

Keep the projects tied at the best value of some key.

Direct Known Subclasses

MaxCost, MaxVotes, MinCost

Instance Method Summary collapse

Instance Method Details

#filter(remaining, ctx) ⇒ Object



35
36
37
38
# File 'lib/equalshares/tie_breaker.rb', line 35

def filter(remaining, ctx)
  best = remaining.map { |c| key(c, ctx) }.public_send(extreme)
  remaining.select { |c| key(c, ctx) == best }
end