Module: RedditKit::Votable
Overview
Methods which determine the voting status of objects.
Instance Method Summary collapse
-
#downvoted? ⇒ Boolean
Whether the current user has downvotes this item.
-
#downvotes ⇒ Object
The number of downvotes an item has.
-
#score ⇒ Object
The score for an item.
-
#upvoted? ⇒ Boolean
Whether the current user has upvoted this item.
-
#upvotes ⇒ Object
The number of upvotes an item has.
-
#voted? ⇒ Boolean
Whether the user has voted on this item (either upvoted or downvoted).
Instance Method Details
#downvoted? ⇒ Boolean
Whether the current user has downvotes this item.
27 28 29 |
# File 'lib/redditkit/votable.rb', line 27 def downvoted? @attributes[:likes] == false end |
#downvotes ⇒ Object
The number of downvotes an item has.
12 13 14 |
# File 'lib/redditkit/votable.rb', line 12 def downvotes @attributes[:downs] end |
#score ⇒ Object
The score for an item.
17 18 19 |
# File 'lib/redditkit/votable.rb', line 17 def score @attributes[:score] end |
#upvoted? ⇒ Boolean
Whether the current user has upvoted this item.
22 23 24 |
# File 'lib/redditkit/votable.rb', line 22 def upvoted? @attributes[:likes] == true end |
#upvotes ⇒ Object
The number of upvotes an item has.
7 8 9 |
# File 'lib/redditkit/votable.rb', line 7 def upvotes @attributes[:ups] end |
#voted? ⇒ Boolean
Whether the user has voted on this item (either upvoted or downvoted).
32 33 34 |
# File 'lib/redditkit/votable.rb', line 32 def voted? !@attributes[:likes].nil? end |