Class: ActsAsCaesar::Candidate
- Inherits:
-
Object
- Object
- ActsAsCaesar::Candidate
- Defined in:
- lib/acts_as_caesar/objects/candidate.rb
Instance Method Summary collapse
-
#initialize(source) ⇒ Candidate
constructor
A new instance of Candidate.
- #key ⇒ Object
- #to_json(*args) ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(source) ⇒ Candidate
Returns a new instance of Candidate.
6 7 8 |
# File 'lib/acts_as_caesar/objects/candidate.rb', line 6 def initialize(source) @source = source end |
Instance Method Details
#key ⇒ Object
10 11 12 |
# File 'lib/acts_as_caesar/objects/candidate.rb', line 10 def key Key.for_source(source) end |
#to_json(*args) ⇒ Object
14 15 16 |
# File 'lib/acts_as_caesar/objects/candidate.rb', line 14 def to_json(*args) key end |
#total ⇒ Object
18 19 20 |
# File 'lib/acts_as_caesar/objects/candidate.rb', line 18 def total @total ||= Persistence.vote_total(self) end |