Module: Supervotes

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

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#down_votesObject



10
11
12
# File 'lib/supervotes.rb', line 10

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

#total_votesObject



14
15
16
# File 'lib/supervotes.rb', line 14

def total_votes
  up_votes - down_votes
end

#up_votesObject



6
7
8
# File 'lib/supervotes.rb', line 6

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