module Redd::Objects::Thing::Votable
Things that can be voted upon.
Public Instance Methods
clear_vote()
click to toggle source
Remove your vote on the thing.
# File lib/redd/objects/thing/votable.rb, line 17 def clear_vote vote(0) end
Also aliased as: unvote
downvote()
click to toggle source
Downvote the thing.
# File lib/redd/objects/thing/votable.rb, line 12 def downvote vote(-1) end
upvote()
click to toggle source
Upvote the thing.
# File lib/redd/objects/thing/votable.rb, line 7 def upvote vote(1) end
Private Instance Methods
vote(direction)
click to toggle source
Send a vote. @param [-1, 0, 1] direction The direction to vote in.
# File lib/redd/objects/thing/votable.rb, line 26 def vote(direction) post('/api/vote', id: fullname, dir: direction) self[:ups] += direction end