1 # Range voting as described in wikipedia.
2 # (http://en.wikipedia.org/wiki/Range_voting)
4 class RangeVote < ElectionVote
5 def initialize(votes = nil, range = 1..10)
15 def verify_vote(vote=nil)
16 vote.instance_of?(Hash) && vote.all?{|c,score| @valid_range.include?(score)}
20 vote.each do |candidate, score|
21 if @votes.has_key?(candidate)
22 @votes[candidate] += score
24 @votes[candidate] = score
25 @candidates << candidate
31 class RangeResult < PluralityResult