class ElectionVote
attr_reader :votes
attr_reader :candidates
-
+
def initialize(votes=nil)
@votes = Hash.new unless defined?(@votes)
@candidates = Array.new unless defined?(@candidates)
class ElectionResult
attr_reader :winners
-
+ attr_reader :election
+
def initialize(voteobj=nil)
unless voteobj and voteobj.kind_of?( ElectionVote )
raise ArgumentError, "You must pass a ElectionVote array.", caller