Class: Meekster::Candidate
- Inherits:
-
Object
- Object
- Meekster::Candidate
- Defined in:
- lib/meekster/candidate.rb
Constant Summary collapse
- STATES =
[:hopeful, :withdrawn, :elected, :defeated]
Instance Attribute Summary collapse
-
#keep_factor ⇒ Object
Returns the value of attribute keep_factor.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#votes ⇒ Object
Returns the value of attribute votes.
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ Candidate
constructor
A new instance of Candidate.
Constructor Details
#initialize(name = nil) ⇒ Candidate
Returns a new instance of Candidate.
8 9 10 11 12 |
# File 'lib/meekster/candidate.rb', line 8 def initialize(name=nil) self.name = name self.keep_factor = BigDecimal("1") self.votes = BigDecimal('0') end |
Instance Attribute Details
#keep_factor ⇒ Object
Returns the value of attribute keep_factor.
6 7 8 |
# File 'lib/meekster/candidate.rb', line 6 def keep_factor @keep_factor end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/meekster/candidate.rb', line 6 def name @name end |
#state ⇒ Object
Returns the value of attribute state.
6 7 8 |
# File 'lib/meekster/candidate.rb', line 6 def state @state end |
#votes ⇒ Object
Returns the value of attribute votes.
6 7 8 |
# File 'lib/meekster/candidate.rb', line 6 def votes @votes end |