Class: Dbl::Votes
- Inherits:
-
Object
- Object
- Dbl::Votes
- Defined in:
- lib/topgg/votes.rb
Overview
This class Spreads the Vote response body into different methods.
Instance Attribute Summary collapse
-
#obj ⇒ Hash
(also: #raw, #data)
readonly
Get raw hash return of the object.
Instance Method Summary collapse
-
#first ⇒ Spreader::User
Get the first vote amongst all the other votes.
-
#initialize(obj) ⇒ Votes
constructor
Initializes the votes class.
-
#total ⇒ Integer
Get the total number of votes.
Constructor Details
#initialize(obj) ⇒ Votes
Initializes the votes class
6 7 8 |
# File 'lib/topgg/votes.rb', line 6 def initialize(obj) @obj = obj end |
Instance Attribute Details
#obj ⇒ Hash (readonly) Also known as: raw, data
Get raw hash return of the object
12 13 14 |
# File 'lib/topgg/votes.rb', line 12 def obj @obj end |
Instance Method Details
#first ⇒ Spreader::User
Get the first vote amongst all the other votes.
19 20 21 |
# File 'lib/topgg/votes.rb', line 19 def first Spreader::User.new(@obj[0]) end |
#total ⇒ Integer
Get the total number of votes
25 26 27 |
# File 'lib/topgg/votes.rb', line 25 def total @obj.length end |