projects
/
selectricity
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move to agplv3
[selectricity]
/
lib
/
rubyvote
/
election.rb
diff --git
a/lib/rubyvote/election.rb
b/lib/rubyvote/election.rb
index ffd31c846e56400e9df945361d5a4c11ebb9df9d..3655a034e7575d7be3541ab49e1be12a80fb0c17 100644
(file)
--- a/
lib/rubyvote/election.rb
+++ b/
lib/rubyvote/election.rb
@@
-45,7
+45,7
@@
class ElectionVote
if self.verify_vote(vote)
self.tally_vote(vote)
else
if self.verify_vote(vote)
self.tally_vote(vote)
else
- raise InvalidVoteError.new
("Invalid vote object", vote)
+ raise InvalidVoteError.new("Invalid vote object", vote)
end
end
else
end
end
else
@@
-66,10
+66,6
@@
class ElectionVote
self.verify_vote(vote)
end
self.verify_vote(vote)
end
- def filter_out(winner)
- @candidates.delete_if {|x| winner.winners.include?(x)}
- end
-
end
class PluralityVote < ElectionVote
end
class PluralityVote < ElectionVote
@@
-118,6
+114,7
@@
end
class ElectionResult
attr_reader :winners
class ElectionResult
attr_reader :winners
+ attr_reader :election
def initialize(voteobj=nil)
unless voteobj and voteobj.kind_of?( ElectionVote )
def initialize(voteobj=nil)
unless voteobj and voteobj.kind_of?( ElectionVote )
@@
-135,7
+132,7
@@
class ElectionResult
def winner?
@winners.length > 0 and not @winners[0].nil?
end
def winner?
@winners.length > 0 and not @winners[0].nil?
end
-
+
end
class PluralityResult < ElectionResult
end
class PluralityResult < ElectionResult
Benjamin Mako Hill
||
Want to submit a patch?