Module: SuperVotes

Defined in:
lib/super_votes.rb,
lib/super_votes/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#down_votesObject



8
9
10
# File 'lib/super_votes.rb', line 8

def down_votes
  self.votes.where(vote: false).length
end

#total_votesObject



12
13
14
# File 'lib/super_votes.rb', line 12

def total_votes
  up_votes - down_votes
end

#up_votesObject



4
5
6
# File 'lib/super_votes.rb', line 4

def up_votes
  self.votes.where(vote: true).length
end