# module Votes

### Public Instance Methods

downvotes() click to toggle source

Return the number of -1 comments (downvotes)

    # File app/roles/votes.rb, line 16
    def downvotes
      notes.select(&:downvote?).size
    end

downvotes_in_percent() click to toggle source

    # File app/roles/votes.rb, line 20
    def downvotes_in_percent
      if votes_count.zero?
        0
      else
        100.0 - upvotes_in_percent
      end
    end

upvotes() click to toggle source

Return the number of +1 comments (upvotes)

    # File app/roles/votes.rb, line 3
    def upvotes
      notes.select(&:upvote?).size
    end

upvotes_in_percent() click to toggle source

    # File app/roles/votes.rb, line 7
    def upvotes_in_percent
      if votes_count.zero?
        0
      else
        100.0 / votes_count * upvotes
      end
    end

votes_count() click to toggle source

Return the total number of votes

    # File app/roles/votes.rb, line 29
    def votes_count
      upvotes + downvotes
    end