Class: Candidate

Inherits:
Candidates show all
Defined in:
lib/my_segments/candidates.rb

Instance Attribute Summary collapse

Attributes inherited from Candidates

#candidates

Instance Method Summary collapse

Methods inherited from Candidates

#add, #has_id?, #prune, #remove, #size, #sort_by_rank, #to_s, #total_votes, #vote_for

Constructor Details

#initialize(misspelled, solution, id, votes = 0.0) ⇒ Candidate

Returns a new instance of Candidate.


70
71
72
73
74
75
76
# File 'lib/my_segments/candidates.rb', line 70

def initialize(misspelled, solution, id, votes = 0.0)
  @misspelled = misspelled
  @solution   = solution
  @id         = id
  @votes   = votes
  self
end

Instance Attribute Details

#idObject

Returns the value of attribute id.


68
69
70
# File 'lib/my_segments/candidates.rb', line 68

def id
  @id
end

#misspelledObject

Returns the value of attribute misspelled.


68
69
70
# File 'lib/my_segments/candidates.rb', line 68

def misspelled
  @misspelled
end

#solutionObject

Returns the value of attribute solution.


68
69
70
# File 'lib/my_segments/candidates.rb', line 68

def solution
  @solution
end

#votesObject

Returns the value of attribute votes.


68
69
70
# File 'lib/my_segments/candidates.rb', line 68

def votes
  @votes
end