Module: VoteGem

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

Constant Summary collapse

VERSION =
"0.0.1"

Instance Method Summary collapse

Instance Method Details

#down_votesObject



9
10
11
# File 'lib/vote_gem.rb', line 9

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

#total_votesObject



13
14
15
# File 'lib/vote_gem.rb', line 13

def total_votes
  up_votes - down_votes
end

#up_votesObject

Your code goes here…



5
6
7
# File 'lib/vote_gem.rb', line 5

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